/* =========================================================================
   hello.tienela.com — start page
   ========================================================================= */

:root {
  --accent: #5b9cff;
  --accent-ink: #fff;

  --ink: #fff;
  --ink-dim: rgba(255, 255, 255, .72);
  --ink-faint: rgba(255, 255, 255, .48);

  --panel: rgba(22, 24, 32, .52);
  --panel-strong: rgba(18, 20, 28, .88);
  --panel-hover: rgba(255, 255, 255, .14);
  --divider: rgba(255, 255, 255, .12);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .18);
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .45);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --blur: 18px;
  --text-shadow: 0 1px 12px rgba(0, 0, 0, .35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="light"] {
  --ink: #10131a;
  --ink-dim: rgba(16, 19, 26, .68);
  --ink-faint: rgba(16, 19, 26, .45);
  --panel: rgba(255, 255, 255, .62);
  --panel-strong: rgba(252, 253, 255, .94);
  --panel-hover: rgba(16, 19, 26, .08);
  --divider: rgba(16, 19, 26, .10);
  --text-shadow: 0 1px 10px rgba(255, 255, 255, .45);
  --shadow: 0 10px 40px rgba(20, 25, 40, .18);
}

* { box-sizing: border-box; }

/* Layout rules below set `display`, which would otherwise beat the UA's
   [hidden] rule and leave drawers/modals on screen. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: #0d1117;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root[data-theme="light"] body { background: #eef1f6; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }

:where(button, input, select, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------- background */

.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; }

.bg-layer {
  position: absolute;
  /* Bleed past the viewport so a blurred image never shows soft edges. */
  inset: -40px;
  background: linear-gradient(135deg, #1b2735, #090a0f);
  background-size: cover;
  background-position: center;
  filter: blur(var(--bg-blur, 0px));
  transform: scale(1.02);
  transition: filter .35s var(--ease), opacity .6s var(--ease);
}

.bg-layer.swapping { opacity: 0; }

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, .38) 100%),
    rgba(0, 0, 0, var(--bg-dim, .3));
  transition: background .3s var(--ease);
}

:root[data-theme="light"] .bg-overlay {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 22%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .38) 100%),
    rgba(255, 255, 255, var(--bg-dim, .3));
}

body.grain .bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .05;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
}

/* Covers the flash of unstyled background before settings are applied. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0d1117;
  transition: opacity .3s var(--ease);
}
.boot.done { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px 9px 12px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.chip:hover { background: var(--panel-hover); transform: translateY(-1px); }

.weather-icon { display: grid; place-items: center; width: 26px; height: 26px; }
.weather-icon svg { width: 26px; height: 26px; }
.weather-temp { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.weather-city { font-size: 13px; color: var(--ink-dim); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--shadow-sm);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { background: var(--panel-hover); transform: translateY(-1px); }
.icon-btn.ghost { background: none; box-shadow: none; backdrop-filter: none; font-size: 26px; line-height: 1; }
.icon-btn svg { fill: currentColor; }

.avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 650;
  font-size: 15px;
  text-transform: uppercase;
}
.avatar.signed { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------- stage */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 96px 20px 110px;
  text-align: center;
}

body[data-align="left"] .stage { align-items: flex-start; text-align: left; padding-left: min(9vw, 120px); }
body[data-align="left"] .searchbar-stack,
body[data-align="left"] .shortcuts-grid { justify-content: flex-start; }

.hero { display: flex; flex-direction: column; gap: 6px; }

.clock {
  margin: 0;
  font-size: clamp(52px, 11vw, 118px);
  font-weight: 250;
  letter-spacing: -.035em;
  line-height: 1;
  text-shadow: var(--text-shadow);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: .12em;
  justify-content: center;
}
body[data-align="left"] .clock { justify-content: flex-start; }

.clock-sec { font-size: .34em; font-weight: 350; color: var(--ink-faint); letter-spacing: 0; }

.clock-date {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-dim);
  text-shadow: var(--text-shadow);
}

/* Russian and Uzbek write "12 августа", not "12 Августа" — only lift the first letter. */
.clock-date::first-letter { text-transform: uppercase; }

.greeting {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 450;
  color: var(--ink);
  text-shadow: var(--text-shadow);
}

/* ------------------------------------------------------------------ search */

/* Explicit stacking context + positive z-index: .searchbar's own backdrop-filter
   otherwise creates a *local* stacking context that isn't guaranteed to out-rank
   plain sibling content like .shortcuts, which let a shortcut tile paint over
   the open suggestions dropdown. This settles it unambiguously. */
.search { position: relative; z-index: 3; width: min(680px, 100%); display: flex; flex-direction: column; gap: 14px; }

.engine-tabs {
  position: relative;
  /* Above .searchbar so a hovered engine name isn't painted behind it. */
  z-index: 6;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
body[data-align="left"] .engine-tabs { justify-content: flex-start; }

/* Icon-only switcher; the engine name is a hover affordance, not a label.
   Solid white on purpose — a glass/translucent badge let the wallpaper show
   through and made colour logos hard to read on light backgrounds. */
.engine-tab {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: background .18s var(--ease);
}
.engine-tab:hover { background: #f0f0f0; }

/* Selected engine is marked by a dot rather than a ring. */
.engine-tab[aria-selected="true"] { background: #f0f0f0; }
.engine-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

/* Sits above the tab: the gap below is only wide enough for the search bar. */
.engine-name {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 4;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.engine-tab:hover .engine-name,
.engine-tab:focus-visible .engine-name { opacity: 1; transform: translate(-50%, 0); }

.engine-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  flex: none;
  user-select: none;
}
.engine-mark.lg { width: 28px; height: 28px; }
/* DuckDuckGo's own artwork is already a full circle — a white disc under it
   would just show as a ring, so let it fill the badge edge to edge. */
.engine-mark.duckduckgo { object-fit: cover; }

/* Fallback badge when an icon file is missing. */
.engine-mark.badge {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  height: 58px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), background .2s var(--ease);
}
.searchbar:focus-within { background: var(--panel-hover); }

/* Flex-centers the logo instead of relying on inline baseline alignment,
   which left it a couple of pixels off from true vertical/horizontal centre. */
.searchbar-engine {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.searchbar-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 17px;
  letter-spacing: -.01em;
}
.searchbar-input::placeholder { color: var(--ink-faint); }

.searchbar-clear {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-faint);
}
.searchbar-clear:hover { background: var(--panel-hover); color: var(--ink); }

.searchbar-go {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  flex: none;
  transition: filter .18s var(--ease), transform .18s var(--ease);
}
.searchbar-go:hover { filter: brightness(1.12); transform: scale(1.05); }
.searchbar-go svg { fill: currentColor; }

/* suggestions */

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--radius);
  background: var(--panel-strong);
  backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(1.5);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(1.5);
  box-shadow: var(--shadow-lg);
  max-height: 46vh;
  overflow-y: auto;
  text-align: left;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
}
.suggestion svg { fill: var(--ink-faint); flex: none; }
.suggestion span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion[aria-selected="true"], .suggestion:hover { background: var(--panel-hover); }

/* five stacked bars, one per engine */

.searchbar-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.stack-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 0 12px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease), background .2s var(--ease);
}
.stack-row:focus-within {
  background: var(--panel-hover);
  box-shadow: var(--shadow-sm), 0 5px 20px color-mix(in srgb, var(--accent) 20%, transparent);
}
.stack-row input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; }
.stack-row input::placeholder { color: var(--ink-faint); }
.stack-row button[type="submit"] {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--ink-dim); flex: none;
}
.stack-row button[type="submit"]:hover { background: var(--panel-hover); color: var(--ink); }
.stack-row button svg { fill: currentColor; }

/* --------------------------------------------------------------- shortcuts */

.shortcuts { width: min(760px, 100%); }

.shortcuts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 11px;
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  transition: background .18s var(--ease);
}
.tile:hover { background: var(--panel-hover); }
.tile.dragging { opacity: .4; }
.tile.drop-target { background: color-mix(in srgb, var(--accent) 30%, var(--panel)); }

.tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  font-size: 18px;
  font-weight: 650;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tile-icon img { width: 26px; height: 26px; object-fit: contain; }

.tile-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: var(--text-shadow);
}

/* Default: bare icons, with the name floating in on hover so the grid never
   reflows. `data-labels="always"` puts the caption back under the icon. */
body[data-labels="hover"] .tile-label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 4;
  max-width: 130px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
body[data-labels="hover"] .tile:hover .tile-label,
body[data-labels="hover"] .tile:focus-visible .tile-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

body[data-labels="always"] .tile { width: 86px; padding: 12px 6px 10px; }

.tile-edit {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--ink-dim);
  font-size: 14px;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.tile:hover .tile-edit { opacity: 1; }
.tile-edit:hover { color: var(--ink); }

.tile.add .tile-icon { background: rgba(255, 255, 255, .07); color: var(--ink-faint); font-weight: 300; font-size: 24px; box-shadow: none; }

/* --------------------------------------------------------------------- fab */

.fab {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--shadow-sm);
  color: var(--ink-dim);
  transition: all .25s var(--ease);
}
.fab:hover { color: var(--ink); transform: rotate(45deg); background: var(--panel-hover); }
.fab svg { fill: currentColor; }

/* ------------------------------------------------------------ scrim/drawer */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(2px);
  animation: fade .2s var(--ease);
}

@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop-in { from { transform: translateY(10px) scale(.97); opacity: 0; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--panel-strong);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  box-shadow: var(--shadow-lg);
  animation: slide-in .28s var(--ease);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
}
.drawer-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }

.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.drawer-tabs::-webkit-scrollbar { display: none; }

.drawer-tab {
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: all .18s var(--ease);
}
.drawer-tab:hover { color: var(--ink); background: var(--panel-hover); }
.drawer-tab.active { background: var(--accent); color: var(--accent-ink); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 18px max(28px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

/* ------------------------------------------------------------ form controls */

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--divider);
}
.field:last-child { border-bottom: 0; }
.field.stacked { flex-direction: column; align-items: stretch; gap: 9px; }

.field-label { font-size: 14.5px; font-weight: 500; }
.field-hint { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-faint); font-weight: 400; line-height: 1.45; }

.section-title {
  margin: 22px 0 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--panel-hover);
  transition: background .2s var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .22s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff; }

.input, .select, textarea.input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel-hover);
  outline: none;
  font-size: 14.5px;
  transition: background .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus, .select:focus, textarea.input:focus {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-hover));
  box-shadow: 0 3px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea.input { resize: vertical; min-height: 96px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.select { appearance: none; cursor: pointer; }
:root[data-theme="dark"] .select option { background: #191c24; }

.range { width: 150px; accent-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--panel-hover);
  font-size: 14px;
  font-weight: 550;
  transition: all .18s var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--ink) 12%, var(--panel-hover)); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #ff6b6b; }
.btn.danger:hover { background: rgba(255, 107, 107, .18); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* choice grids (theme, background presets, accents) */

.choices { display: flex; gap: 8px; flex-wrap: wrap; }

.choice {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  background: var(--panel-hover);
  font-size: 13.5px;
  font-weight: 500;
  transition: all .18s var(--ease);
}
.choice.active { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .18);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 3px var(--ink); }

.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.wall {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  transition: transform .18s var(--ease);
  overflow: hidden;
}
.wall:hover { transform: scale(1.04); }
.wall.active { box-shadow: 0 0 0 3px var(--accent); }
.wall-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
}
.wall:hover .wall-del { opacity: 1; }

/* engine ordering list */

.order-list { display: flex; flex-direction: column; gap: 7px; }
.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-hover);
  font-size: 14px;
  cursor: grab;
}
.order-item.dragging { opacity: .45; }
.order-item .grip { color: var(--ink-faint); font-size: 15px; letter-spacing: -2px; }
.order-item .spacer { flex: 1; }
.order-item .switch { transform: scale(.82); }

/* ------------------------------------------------------------------ modals */

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(3px);
  animation: fade .2s var(--ease);
}

.modal {
  width: min(400px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  box-shadow: var(--shadow-lg);
  animation: pop-in .25s var(--ease);
}

.modal h3 { margin: 0 0 4px; font-size: 20px; font-weight: 620; letter-spacing: -.02em; }
.modal p.sub { margin: 0 0 18px; font-size: 13.5px; color: var(--ink-faint); line-height: 1.5; }

.modal-tabs { display: flex; gap: 4px; margin-bottom: 18px; padding: 4px; border-radius: var(--radius-pill); background: var(--panel-hover); }
.modal-tab { flex: 1; padding: 8px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 550; color: var(--ink-faint); }
.modal-tab.active { background: var(--accent); color: var(--accent-ink); }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--ink-dim); }

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 107, 107, .18);
  font-size: 13px;
  color: #ffb3b3;
}
:root[data-theme="light"] .form-error { color: #a3222a; }

.profile-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--divider);
}
.profile-head .avatar-lg {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 19px;
  font-weight: 650;
  text-transform: uppercase;
  flex: none;
}
.profile-head .who { min-width: 0; }
.profile-head .who b { display: block; font-size: 15px; font-weight: 600; }
.profile-head .who span { font-size: 12.5px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}
.sync-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #45d483; }
.sync-badge.off::before { background: var(--ink-faint); }
.sync-badge.err::before { background: #ff6b6b; }

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 70;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: var(--panel-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 500;
  animation: pop-in .24s var(--ease);
}
.toast.leaving { opacity: 0; transition: opacity .25s var(--ease); }

/* ------------------------------------------------------------- weather card */

.weather-panel { display: flex; flex-direction: column; gap: 14px; }
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-now .big { font-size: 40px; font-weight: 300; letter-spacing: -.03em; }
.weather-now svg { width: 46px; height: 46px; }
.weather-meta { font-size: 13px; color: var(--ink-faint); line-height: 1.6; }
.weather-days { display: flex; gap: 8px; }
.weather-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 6px;
  border-radius: var(--radius-sm);
  background: var(--panel-hover);
  font-size: 12px;
}
.weather-day svg { width: 24px; height: 24px; }
.weather-day .d { color: var(--ink-faint); text-transform: capitalize; }
.weather-day .t { font-weight: 600; }
.weather-day .t small { color: var(--ink-faint); font-weight: 400; }

.city-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.city-result { padding: 10px 12px; border-radius: var(--radius-sm); text-align: left; font-size: 14px; }
.city-result:hover { background: var(--panel-hover); }
.city-result small { display: block; color: var(--ink-faint); font-size: 12px; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .stage { gap: 26px; padding: 84px 16px 96px; }
  .clock { font-size: clamp(46px, 15vw, 76px); }
  .searchbar { height: 52px; }
  .searchbar-input { font-size: 16px; }
  .engine-tab { padding: 6px 11px 6px 7px; font-size: 12.5px; }
  .tile { width: 74px; }
  .drawer { width: 100%; border-left: 0; }
  .weather-city { display: none; }
  body[data-align="left"] .stage { padding-left: 16px; }
  .wall-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
