@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
  color-scheme: dark;
  --ink: #101416; --link-color: #101516; --muted: #d0d3d5; --panel: rgba(48, 49, 51, .72);
  --panel-deep: rgba(35, 37, 40, .82); --accent: #79a9ff; --radius: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, system-ui, sans-serif; }
body { min-height: 100vh; color: var(--ink); overflow-x: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.wallpaper {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 73% 14%, rgba(0,185,169,.55), transparent 32%),
    radial-gradient(ellipse at 91% 52%, rgba(0,111,112,.68), transparent 38%),
    radial-gradient(ellipse at 8% 82%, rgba(255,255,255,.42), transparent 38%),
    linear-gradient(112deg, #e8c9a5 0%, #f0d9bb 34%, #a8cfc3 54%, #087e79 100%);
}
.wallpaper::after {
  content:""; position:absolute; inset:0;
  background: repeating-radial-gradient(ellipse at 48% 48%, transparent 0 17px, rgba(255,255,255,.075) 18px 20px, transparent 21px 34px);
  opacity:.55; mix-blend-mode:soft-light;
}
.topbar {
  width: min(880px, calc(100% - 32px)); min-height: 48px; margin: 8px auto 0;
  padding: 4px 10px; display:flex; align-items:center; justify-content:center; gap:12px;
  border:1px solid rgba(255,255,255,.13); border-radius:14px;
  background:rgba(37, 54, 52, .54); backdrop-filter:blur(18px); color:#101719;
  box-shadow:0 5px 24px rgba(0,0,0,.08);
}
.groups, .toolbar { display:flex; align-items:center; gap:4px; }
.groups { flex:1; justify-content:center; }
.group-tab { border:0; background:transparent; color:inherit; padding:9px 13px; border-radius:10px; font-size:14px; }
.group-tab.active { color:#f4f5f6; background:rgba(47,49,53,.83); box-shadow:0 2px 7px #0002; }
.group-tab.add { font-weight:700; font-size:19px; padding:5px 11px; }
.toolbar { gap:6px; }
.icon-button, .settings-toggle, .dots, .close { border:0; background:transparent; color:inherit; }
.icon-button { width:39px; height:36px; font-size:23px; border-radius:9px; color:#071617; }
.icon-button:hover, .settings-toggle:hover { background:rgba(255,255,255,.2); }
.settings-toggle { position:fixed; top:57px; right:18px; font-size:20px; padding:7px; color:#102021; }
.page { width:min(940px, calc(100% - 32px)); margin:68px auto 38px; display:flex; flex-direction:column; align-items:center; }
.search {
  width:min(840px, 100%); height:54px; display:flex; align-items:center; gap:13px;
  padding:0 17px; border-radius:17px; background:#252629; color:#e8e9eb;
  border:2px solid #79a5ff; box-shadow:0 3px 9px #0002;
}
.search-mark { font-family:Georgia,serif; font-weight:700; font-size:17px; }
.search input { flex:1; min-width:0; border:0; outline:0; color:#f3f3f3; background:transparent; font-size:15px; }
.search input::placeholder { color:#77797e; }
.search select { max-width:145px; border:0; outline:0; color:#d9dce2; background:#34363a; border-radius:8px; padding:7px 9px; font-size:12px; }
.search select option { background:#252629; color:#f3f3f3; }
.search button { border:0; background:transparent; color:#b9bdc4; font-size:19px; }
.speed-dial { width:min(820px,100%); display:grid; grid-template-columns:repeat(7, minmax(72px,1fr)); gap:26px 16px; margin:58px auto 0; }
.shortcut { position:relative; min-width:0; display:flex; flex-direction:column; align-items:center; gap:10px; color:#101516; text-decoration:none; text-align:center; }
.shortcut-icon {
  width:58px; height:58px; border-radius:12px; display:grid; place-items:center;
  background:rgba(88,91,91,.56); color:#fff; font-size:28px; font-weight:600;
  box-shadow:0 3px 8px rgba(0,0,0,.18); backdrop-filter:blur(10px);
  transition:transform .16s ease, box-shadow .16s ease;
}
.shortcut-icon img { width:100%; height:100%; object-fit:contain; padding:7px; border-radius:inherit; }
.shortcut-icon.image-icon { background:rgba(255,255,255,.78) !important; padding:0; overflow:hidden; }
.shortcut:hover .shortcut-icon { transform:translateY(-3px); box-shadow:0 8px 17px #0003; }
.shortcut-link, .shortcut-link:visited, .shortcut-link:hover, .shortcut-link:focus {
  width:100%; display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  gap:8px; color:var(--link-color); text-decoration:none; text-align:center;
}
.shortcut-icon img { display:block; object-fit:contain; object-position:center center; margin:auto; }
.shortcut-label { color:var(--link-color); text-decoration:none; text-shadow:0 1px 3px #ffffff66; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; text-shadow:0 1px 3px #fff8; }
.shortcut-actions { position:absolute; top:-8px; right:calc(50% - 43px); display:none; gap:2px; }
.shortcut:hover .shortcut-actions { display:flex; }
.shortcut-actions button { border:0; border-radius:50%; width:22px; height:22px; background:#252629; color:white; font-size:12px; }
.widgets { width:min(940px,100%); display:grid; grid-template-columns:1fr 1fr; gap:28px; margin-top:58px; }
.widget {
  min-height:228px; padding:13px 14px 12px; border-radius:var(--radius);
  color:#e5e7eb; background:var(--panel); backdrop-filter:blur(17px);
  box-shadow:0 4px 12px #0002; border:1px solid rgba(255,255,255,.12);
}
.widget-heading { display:flex; justify-content:space-between; align-items:center; color:#cbd0d5; font-size:12px; margin-bottom:14px; }
.dots { color:#e4e5e7; font-size:20px; line-height:12px; letter-spacing:2px; }
.weather-content { display:grid; grid-template-columns:1fr 1fr; align-items:center; min-height:132px; padding:0 24px; }
.weather-place { font-size:25px; font-weight:500; }
.weather-date { color:#d1d5db; font-size:15px; margin:4px 0 2px; }
.weather-main { display:flex; align-items:center; gap:15px; font-size:37px; }
.weather-main strong { font-size:23px; font-weight:500; }
.weather-details { display:grid; gap:9px; color:#d1d5db; font-size:13px; }
.weather-details div { display:flex; justify-content:space-between; gap:12px; }
.weather-details b { color:#f0f1f2; font-weight:600; white-space:nowrap; }
.widget-footer { display:flex; justify-content:space-between; color:#c4c8cc; font-size:11px; margin-top:6px; }
.widget-footer button { color:inherit; border:0; background:transparent; font-size:17px; }
.activity-total { min-height:88px; border-radius:10px; padding:17px; background:rgba(30,32,35,.5); display:flex; align-items:center; justify-content:space-between; }
.activity-total small, .activity-stats small { display:block; color:#d1d5db; font-size:12px; }
.activity-total strong { display:block; font-size:31px; margin-top:5px; }
.activity-glyph { font-size:43px; opacity:.75; }
.activity-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:9px; }
.activity-stats div { min-height:75px; padding:11px 9px; border-radius:9px; background:rgba(30,32,35,.47); }
.activity-stats strong { display:block; font-size:16px; margin-top:13px; white-space:nowrap; }
.add-controls { display:flex; margin-top:104px; overflow:hidden; border-radius:11px; background:rgba(255,248,239,.9); box-shadow:0 2px 7px #0001; }
.add-controls button { border:0; padding:9px 15px; background:transparent; color:#17191b; font-size:13px; }
.add-controls button + button { border-left:1px solid #d8cfc5; }
.add-controls button:hover { background:#fff; }
.settings-panel {
  position:fixed; z-index:5; top:62px; right:18px; width:min(340px,calc(100vw - 36px));
  padding:20px; border-radius:15px; background:rgba(34,36,39,.96); color:#f1f2f3;
  box-shadow:0 12px 40px #0005; border:1px solid #ffffff24;
}
.panel-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.panel-heading h2, dialog h2 { margin:0; font-size:18px; }
.close { font-size:25px; color:#ddd; }
.settings-panel label, dialog label { display:grid; gap:7px; margin:13px 0; color:#d9dce0; font-size:13px; }
.settings-panel input, .settings-panel select, dialog input, dialog select {
  width:100%; border:1px solid #666a70; background:#292c30; color:#f5f5f5;
  padding:10px 11px; border-radius:8px; outline:none;
}
.settings-panel input[type="color"] { height:40px; padding:4px; cursor:pointer; }
.settings-panel input:focus, dialog input:focus { border-color:var(--accent); }
.settings-panel .check-row { display:flex; align-items:center; gap:9px; }
.check-row input { width:auto; }
.primary, .secondary { border:0; border-radius:8px; padding:10px 14px; }
.primary { background:#8eb5ff; color:#111923; font-weight:600; }
.secondary { background:#45484d; color:#eee; }
.hint { color:#aeb4bb; font-size:11px; line-height:1.5; }
dialog { width:min(390px,calc(100vw - 30px)); border:1px solid #ffffff28; border-radius:15px; padding:22px; color:#f1f2f3; background:#25282c; box-shadow:0 15px 60px #0008; }
dialog::backdrop { background:#10141688; backdrop-filter:blur(4px); }
.dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:20px; }
.toast { position:fixed; bottom:22px; left:50%; transform:translate(-50%,15px); opacity:0; pointer-events:none; background:#202326; color:#fff; border:1px solid #ffffff22; padding:10px 15px; border-radius:9px; transition:.2s; font-size:13px; }
.toast.show { opacity:1; transform:translate(-50%,0); }
@media (max-width:760px) {
  .topbar { flex-wrap:wrap; padding:5px; }
  .groups { flex-wrap:wrap; }
  .group-tab { padding:7px 9px; }
  .toolbar { justify-content:center; width:100%; }
  .page { margin-top:45px; }
  .speed-dial { grid-template-columns:repeat(4,minmax(60px,1fr)); gap:24px 10px; margin-top:42px; }
  .widgets { grid-template-columns:1fr; gap:15px; margin-top:38px; }
  .add-controls { margin-top:45px; }
  .settings-toggle { top:10px; right:10px; }
}
@media (max-width:420px) {
  .weather-content { padding:0 5px; }
  .activity-stats { grid-template-columns:repeat(2,1fr); }
  .widget { min-height:unset; }
}
.lock-indicator { position:fixed; top:58px; left:18px; z-index:4; padding:8px 12px; border-radius:9px; background:rgba(35,37,40,.88); color:#fff; font-size:12px; backdrop-filter:blur(10px); }
.lock-controls { display:flex; gap:8px; margin-top:12px; }
.lock-controls button { flex:1; font-size:12px; }
body.config-locked .shortcut-actions, body.config-locked #addShortcut, body.config-locked #addWidget, body.config-locked #newGroup { display:none !important; }
body.config-locked #settingsPanel input, body.config-locked #settingsPanel select, body.config-locked #saveSettings { opacity:.55; pointer-events:none; }


/* Speed Dial sorting */
.shortcut[draggable="true"] { cursor:grab; }
.shortcut.dragging { opacity:.38; cursor:grabbing; }
.shortcut.drag-over .shortcut-icon { outline:3px dashed var(--accent); outline-offset:4px; }
@media (pointer:coarse) {
  .shortcut { touch-action:pan-y; }
  .shortcut.dragging { touch-action:none; }
}

/* Portrait phones and narrow touch screens: use the device's actual viewport,
   not only a desktop-width breakpoint (some mobile browsers request desktop layout). */
@media (pointer:coarse) and (orientation:portrait) {
  html, body { width:100%; max-width:100%; overflow-x:hidden; }
  .topbar {
    width:calc(100% - 20px); max-width:100%; margin:8px auto 0;
    padding:7px 8px; gap:5px; flex-wrap:wrap; border-radius:18px;
  }
  .groups { flex:1 1 100%; width:100%; display:flex; flex-wrap:wrap; justify-content:center; gap:3px; }
  .group-tab { flex:0 1 auto; padding:8px 11px; font-size:clamp(13px,3.6vw,16px); }
  .toolbar { width:100%; justify-content:space-evenly; gap:3px; }
  .icon-button { flex:0 1 42px; width:42px; height:36px; font-size:21px; }
  .settings-toggle { top:12px; right:12px; z-index:6; }
  .page { width:calc(100% - 28px); max-width:100%; margin:34px auto 28px; }
  .search {
    width:100%; max-width:100%; height:56px; padding:0 10px; gap:7px;
    display:grid; grid-template-columns:22px minmax(0,1fr) minmax(88px,112px) 20px;
    border-radius:15px;
  }
  .search-mark { font-size:19px; text-align:center; }
  .search input { width:100%; min-width:0; font-size:14px; }
  .search select { width:100%; max-width:112px; min-width:0; padding:8px 5px; font-size:11px; }
  .search button { width:20px; padding:0; font-size:17px; }
  .speed-dial {
    width:100%; max-width:100%; grid-template-columns:repeat(3,minmax(0,1fr));
    gap:23px 8px; margin:34px auto 0;
  }
  .shortcut { min-width:0; width:100%; }
  .shortcut-icon { width:clamp(58px,17vw,76px); height:clamp(58px,17vw,76px); border-radius:14px; }
  .shortcut-label { width:100%; font-size:clamp(11px,3.4vw,14px); }
  .shortcut-actions { right:calc(50% - 46px); }
  .widgets { width:100%; max-width:100%; grid-template-columns:minmax(0,1fr); gap:14px; margin-top:34px; }
  .widget { width:100%; min-width:0; }
  .weather-content { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; padding:0 5px; }
  .weather-place { font-size:clamp(19px,5vw,24px); }
  .weather-details { font-size:12px; }
  .activity-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .activity-stats div { min-width:0; }
  .activity-stats strong { white-space:normal; overflow-wrap:anywhere; }
  .add-controls { margin-top:38px; }
}
