/* =========================================================
   拾光 LUMI — a quiet little corner of the internet
   ========================================================= */

:root {
  --bg: #070a12;
  --bg-deep: #050810;
  --text: #f5f2eb;
  --text-soft: #d6d3cc;
  --muted: #959db0;
  --muted-2: #697286;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.15);
  --panel: rgba(17, 22, 37, 0.62);
  --panel-strong: rgba(18, 24, 40, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --field: rgba(255, 255, 255, 0.05);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 16px 44px rgba(0, 0, 0, 0.2);
  --accent: #ffb86b;
  --accent-2: #ff7a9e;
  --accent-3: #8b7bff;
  --mint: #5eead4;
  --accent-ink: #1a1207;
  --success: #5eead4;
  --danger: #ff8099;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 13px;
  --cloud-a: #e9eeff;
  --cloud-b: #a9b6d8;
  --cloud-shadow: rgba(84, 101, 145, 0.34);
  --snake-board: #0a1020;
  --snake-grid: rgba(255, 255, 255, 0.035);
  --snake-body: #5eead4;
  --snake-head: #a7fff0;
  --food: #ff7a9e;
  --ttt-bg: rgba(255, 255, 255, 0.025);
  --ttt-cell: rgba(255, 255, 255, 0.045);
  --tile-empty: rgba(255, 255, 255, 0.045);
  --font-sans: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="light"] {
  --bg: #f2eee7;
  --bg-deep: #e9e3d9;
  --text: #201f26;
  --text-soft: #3b3944;
  --muted: #706b79;
  --muted-2: #95909c;
  --line: rgba(35, 31, 43, 0.09);
  --line-strong: rgba(35, 31, 43, 0.17);
  --panel: rgba(255, 255, 255, 0.64);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.42);
  --panel-hover: rgba(255, 255, 255, 0.72);
  --field: rgba(255, 255, 255, 0.54);
  --shadow: 0 30px 80px rgba(92, 79, 65, 0.14);
  --shadow-soft: 0 14px 38px rgba(92, 79, 65, 0.1);
  --accent: #e47a37;
  --accent-2: #d9587d;
  --accent-3: #6b5ae0;
  --mint: #199f91;
  --accent-ink: #fffaf3;
  --success: #138f82;
  --danger: #d14f6b;
  --cloud-a: #ffffff;
  --cloud-b: #c4cce1;
  --cloud-shadow: rgba(115, 126, 158, 0.25);
  --snake-board: #f8f4ed;
  --snake-grid: rgba(35, 31, 43, 0.055);
  --snake-body: #199f91;
  --snake-head: #0a756b;
  --food: #d9587d;
  --ttt-bg: rgba(255, 255, 255, 0.4);
  --ttt-cell: rgba(255, 255, 255, 0.7);
  --tile-empty: rgba(35, 31, 43, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: rgba(150, 157, 176, 0.35) transparent;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease-soft), color 0.5s var(--ease-soft);
}

::selection {
  background: rgba(255, 184, 107, 0.3);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

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

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

.svg-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inline-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =========================================================
   Ambient atmosphere
   ========================================================= */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% -20%, rgba(80, 66, 150, 0.17), transparent 65%),
    radial-gradient(ellipse 70% 60% at 100% 100%, rgba(27, 76, 92, 0.15), transparent 65%),
    var(--bg);
  transition: background 0.6s var(--ease-soft);
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}

.aurora-one {
  width: 58vw;
  height: 48vw;
  min-width: 540px;
  min-height: 460px;
  top: -22vw;
  left: 8vw;
  background: radial-gradient(circle at 40% 40%, rgba(255, 138, 92, 0.5), rgba(255, 93, 142, 0.16) 48%, transparent 70%);
  animation: aurora-drift-one 26s ease-in-out infinite alternate;
}

.aurora-two {
  width: 50vw;
  height: 48vw;
  min-width: 460px;
  min-height: 440px;
  top: 14vh;
  right: -20vw;
  background: radial-gradient(circle at 50% 50%, rgba(107, 90, 224, 0.4), rgba(52, 88, 180, 0.12) 50%, transparent 72%);
  animation: aurora-drift-two 32s ease-in-out infinite alternate;
}

.aurora-three {
  width: 42vw;
  height: 38vw;
  min-width: 420px;
  min-height: 400px;
  bottom: -20vh;
  left: -12vw;
  background: radial-gradient(circle at 50% 50%, rgba(32, 174, 158, 0.24), rgba(28, 94, 124, 0.1) 52%, transparent 72%);
  animation: aurora-drift-three 29s ease-in-out infinite alternate;
}

html[data-theme="light"] .ambient {
  background:
    radial-gradient(ellipse 90% 64% at 50% -18%, rgba(255, 184, 130, 0.24), transparent 66%),
    radial-gradient(ellipse 70% 60% at 102% 96%, rgba(99, 180, 176, 0.17), transparent 66%),
    radial-gradient(ellipse 60% 50% at -10% 40%, rgba(147, 126, 226, 0.12), transparent 70%),
    var(--bg);
}

html[data-theme="light"] .aurora {
  opacity: 0.42;
  mix-blend-mode: multiply;
  filter: blur(110px);
}

html[data-theme="light"] .aurora-one {
  background: radial-gradient(circle at 40% 40%, rgba(255, 179, 108, 0.38), rgba(255, 123, 158, 0.1) 50%, transparent 70%);
}

html[data-theme="light"] .aurora-two {
  background: radial-gradient(circle at 50% 50%, rgba(136, 115, 229, 0.26), rgba(85, 127, 200, 0.08) 52%, transparent 72%);
}

html[data-theme="light"] .aurora-three {
  background: radial-gradient(circle at 50% 50%, rgba(45, 174, 159, 0.16), transparent 72%);
}

.grid-glow {
  position: absolute;
  inset: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, black, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, black, transparent 80%);
}

html[data-theme="light"] .grid-glow {
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(35, 31, 43, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 31, 43, 0.035) 1px, transparent 1px);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.65;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 27% 31%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.4px 1.4px at 41% 12%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 64% 21%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.2px 1.2px at 79% 9%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 91% 27%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 8% 58%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.3px 1.3px at 32% 76%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 54% 44%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 88% 68%, rgba(255, 255, 255, 0.5), transparent);
  animation: stars-breathe 7s ease-in-out infinite alternate;
}

html[data-theme="light"] .stars {
  display: none;
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes aurora-drift-one {
  from { transform: translate3d(-2%, -3%, 0) scale(1) rotate(-4deg); }
  to { transform: translate3d(10%, 7%, 0) scale(1.12) rotate(5deg); }
}

@keyframes aurora-drift-two {
  from { transform: translate3d(5%, -5%, 0) scale(1.05); }
  to { transform: translate3d(-9%, 10%, 0) scale(0.94); }
}

@keyframes aurora-drift-three {
  from { transform: translate3d(-4%, 6%, 0) scale(0.95); }
  to { transform: translate3d(8%, -5%, 0) scale(1.08); }
}

@keyframes stars-breathe {
  from { opacity: 0.4; }
  to { opacity: 0.8; }
}

/* =========================================================
   Top bar
   ========================================================= */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 60;
  width: min(1320px, calc(100% - 48px));
  height: 66px;
  margin: 16px auto 0;
  padding: 8px 12px 8px 18px;
  display: flex;
  align-items: center;
  gap: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg) 66%, transparent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

html[data-theme="light"] .topbar {
  background: rgba(255, 252, 247, 0.66);
  box-shadow: 0 14px 40px rgba(92, 79, 65, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, #ffd28a 0%, #ff9a6b 36%, #ff7a9e 68%, #927dff 100%);
  box-shadow: 0 6px 20px rgba(255, 122, 158, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transform: rotate(-3deg);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  animation: mark-spin 12s linear infinite;
}

@keyframes mark-spin {
  to { transform: rotate(360deg); }
}

.brand-word {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand-word i {
  margin-left: 4px;
  font-size: 9.5px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--muted-2);
  vertical-align: 1px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.main-nav a {
  padding: 7px 14px;
  font-size: 13px;
  color: var(--muted);
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.main-nav a.active {
  color: var(--text);
  background: var(--panel-hover);
  box-shadow: inset 0 0 0 1px var(--line);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 10px;
  line-height: 1.25;
}

.clock strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.clock span {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
}

.icon-button:hover {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--line);
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.icon-button.small svg {
  width: 16px;
  height: 16px;
}

.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
html[data-theme="light"] .theme-icon-sun { display: block; }
html[data-theme="light"] .theme-icon-moon { display: none; }
.sound-off { display: none; }
html[data-sound="off"] .sound-on { display: none; }
html[data-sound="off"] .sound-off { display: block; }

/* =========================================================
   Layout & panels
   ========================================================= */

main {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.045), transparent 36%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  overflow: hidden;
  transition: background 0.45s, border-color 0.45s, box-shadow 0.45s;
}

html[data-theme="light"] .panel {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.68), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.018);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal-in 0.9s var(--ease-out) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes reveal-in {
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  padding-top: 76px;
}

.hero-copy {
  max-width: 980px;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.13em;
  color: var(--muted);
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.eyebrow-divider {
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}

.hero h1 {
  margin: 20px 0 0;
  font-size: clamp(46px, 5.7vw, 78px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.045em;
  color: var(--text);
}

.hero h1 em {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 500;
  letter-spacing: -0.055em;
  background: linear-gradient(105deg, #ffd9a3 0%, #ff9d83 38%, #ff87aa 65%, #ad9bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="light"] .hero h1 em {
  background: linear-gradient(105deg, #d5792f 0%, #d8585a 40%, #c94c80 66%, #6a58d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-sub {
  margin: 19px 0 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 42px;
  align-items: stretch;
}

/* =========================================================
   Weather
   ========================================================= */

.weather-panel {
  padding: 26px 28px 24px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.weather-location {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.weather-location .inline-icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.city-name {
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 3px;
  padding: 3px 8px;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.live-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

.live-badge.is-offline i {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}

.city-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 180px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted-2);
  transition: border-color 0.22s, background 0.22s, width 0.3s var(--ease-out);
}

.city-search:focus-within {
  width: 220px;
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  background: var(--field);
}

.city-search .inline-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.city-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.city-search input::placeholder {
  color: var(--muted-2);
}

.city-search input::-webkit-search-cancel-button {
  display: none;
}

.city-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 238px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px);
}

.city-results[hidden] {
  display: none;
}

.city-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: background 0.16s;
}

.city-result:hover {
  background: var(--panel-hover);
}

.city-result strong {
  font-size: 12.5px;
  font-weight: 550;
}

.city-result span {
  font-size: 10px;
  color: var(--muted-2);
}

.city-result-empty {
  padding: 12px 10px;
  font-size: 11px;
  color: var(--muted-2);
}

.weather-main {
  display: grid;
  grid-template-columns: 142px minmax(130px, 0.75fr) minmax(210px, 1.15fr);
  align-items: center;
  gap: 18px;
  margin: 22px 0 24px;
}

.weather-visual {
  position: relative;
  width: 142px;
  height: 142px;
  display: grid;
  place-items: center;
}

.wx-orb {
  position: relative;
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 198, 115, 0.2), transparent 44%),
    radial-gradient(circle at 68% 72%, rgba(139, 123, 255, 0.24), transparent 56%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02) 62%, transparent 74%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 20px 36px rgba(255, 255, 255, 0.035),
    0 24px 54px rgba(0, 0, 0, 0.2);
  animation: orb-float 6.5s ease-in-out infinite;
}

html[data-theme="light"] .wx-orb {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 180, 96, 0.28), transparent 46%),
    radial-gradient(circle at 68% 72%, rgba(124, 108, 228, 0.18), transparent 58%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.28) 64%, transparent 76%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 20px 36px rgba(255, 255, 255, 0.4),
    0 22px 50px rgba(123, 104, 85, 0.14);
}

.wx-orb::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.07);
  animation: orbit 34s linear infinite;
}

html[data-theme="light"] .wx-orb::after {
  border-color: rgba(35, 31, 43, 0.08);
}

@keyframes orb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes orbit {
  to { transform: rotate(360deg); }
}

.wx-art {
  width: 112px;
  height: 112px;
  overflow: visible;
}

.wx-sun-core { fill: #ffd177; }
.wx-sun-ray { stroke: #ffd177; stroke-width: 2.6; stroke-linecap: round; }
.wx-sun-glow { fill: #ffb86b; opacity: 0.14; }
.wx-moon { fill: #ffe9b0; }
.wx-moon-glow { fill: #ffe9b0; opacity: 0.12; }
html[data-theme="light"] .wx-moon { fill: #e6a92e; }
html[data-theme="light"] .wx-moon-glow { fill: #e6a92e; opacity: 0.16; }
.wx-cloud-a { fill: var(--cloud-a); }
.wx-cloud-b { fill: var(--cloud-b); }
.wx-cloud-glow { fill: var(--cloud-a); opacity: 0.1; }
.wx-star { fill: #fff4d6; }
.wx-rain { stroke: #7dd3fc; stroke-width: 2.6; stroke-linecap: round; }
.wx-snow { fill: #e9f7ff; }
.wx-bolt { fill: #ffd166; }
.wx-fog { stroke: #c7d2e5; stroke-width: 3.4; stroke-linecap: round; opacity: 0.8; }
.wx-ray-group { transform-origin: 56px 50px; animation: sun-spin 26s linear infinite; }
.wx-sun-group { animation: sun-pulse 5s ease-in-out infinite; }
.wx-moon-group { animation: moon-float 6s ease-in-out infinite; }
.wx-cloud-group-one { animation: cloud-drift 7s ease-in-out infinite; }
.wx-cloud-group-two { animation: cloud-drift-two 9s ease-in-out infinite; }
.wx-rain-drop { animation: rain-fall 1.15s linear infinite; }
.wx-rain-drop:nth-child(2) { animation-delay: 0.28s; }
.wx-rain-drop:nth-child(3) { animation-delay: 0.55s; }
.wx-rain-drop:nth-child(4) { animation-delay: 0.82s; }
.wx-snow-flake { animation: snow-fall 3.4s linear infinite; }
.wx-snow-flake:nth-child(2) { animation-delay: 0.9s; }
.wx-snow-flake:nth-child(3) { animation-delay: 1.8s; }
.wx-bolt-group { animation: bolt-flicker 4.5s ease-in-out infinite; }

@keyframes sun-spin { to { transform: rotate(360deg); } }
@keyframes sun-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes moon-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes cloud-drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@keyframes cloud-drift-two { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
@keyframes rain-fall {
  0% { opacity: 0; transform: translateY(-5px); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(16px); }
}
@keyframes snow-fall {
  0% { opacity: 0; transform: translate(0, -4px); }
  20% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(5px, 18px); }
}
@keyframes bolt-flicker {
  0%, 36%, 40%, 44%, 100% { opacity: 1; }
  38%, 42% { opacity: 0.25; }
}

.weather-reading {
  min-width: 0;
}

.temp-line {
  display: flex;
  align-items: flex-start;
  line-height: 0.86;
}

.temp-line span {
  font-size: clamp(62px, 6.3vw, 88px);
  font-weight: 300;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(160deg, var(--text) 20%, color-mix(in srgb, var(--text) 58%, transparent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.temp-line sup {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0;
}

.condition-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 10px;
}

.condition-line strong {
  font-size: 16px;
  font-weight: 550;
  letter-spacing: 0.03em;
}

.condition-line span {
  font-size: 11px;
  color: var(--muted-2);
}

.range-line {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.weather-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex-shrink: 0;
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-hover);
}

.metric-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric div {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.metric small {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.metric strong {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hourly-section,
.weekly-section {
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-label > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-soft);
}

.section-label small {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.hourly-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, black calc(100% - 20px), transparent);
  -webkit-mask-image: linear-gradient(90deg, black calc(100% - 20px), transparent);
}

.hourly-strip::-webkit-scrollbar {
  display: none;
}

.hour-card {
  flex: 0 0 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 4px 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: background 0.2s, border-color 0.2s;
}

.hour-card:hover {
  background: var(--panel-soft);
  border-color: var(--line);
}

.hour-card.now {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

.hour-card time {
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.03em;
}

.hour-icon {
  width: 28px;
  height: 28px;
}

.hour-icon svg {
  width: 100%;
  height: 100%;
}

.hour-temp {
  font-size: 12.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.hour-rain {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 8.5px;
  color: #7cb8e8;
}

html[data-theme="light"] .hour-rain {
  color: #3b7ba9;
}

.hour-rain svg {
  width: 8px;
  height: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.weekly-section {
  margin-top: 16px;
}

.weekly-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 2px;
  border-radius: 12px;
  transition: background 0.2s;
}

.week-day:hover {
  background: var(--panel-soft);
}

.week-day.today {
  background: var(--panel-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.week-day .day-name {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.week-day.today .day-name {
  color: var(--accent);
  font-weight: 600;
}

.week-icon {
  width: 23px;
  height: 23px;
}

.week-icon svg {
  width: 100%;
  height: 100%;
}

.week-temps {
  display: flex;
  gap: 4px;
  align-items: baseline;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.week-temps strong {
  font-size: 11px;
  font-weight: 550;
}

.week-temps span {
  color: var(--muted-2);
}

.temp-bar {
  position: relative;
  width: 32px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--panel-hover);
}

.temp-bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--start, 0%);
  width: var(--len, 50%);
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #ffd177 55%, #ff8a9d);
}

/* =========================================================
   Calendar
   ========================================================= */

.calendar-panel {
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
}

.panel-kicker {
  margin-bottom: 5px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.24em;
  color: var(--muted-2);
}

.calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.calendar-head h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.today-button {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10.5px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.today-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 18px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.calendar-weekdays span {
  text-align: center;
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: 0.08em;
}

.calendar-weekdays span:nth-child(6),
.calendar-weekdays span:nth-child(7) {
  color: color-mix(in srgb, var(--accent-2) 64%, var(--muted-2));
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 47px;
  padding: 7px 0 4px;
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.cal-day:hover {
  background: var(--panel-soft);
  border-color: var(--line);
}

.cal-day:active {
  transform: scale(0.95);
}

.cal-solar {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.cal-lunar {
  font-size: 7.5px;
  line-height: 1.3;
  color: var(--muted-2);
  transform: scale(0.92);
  white-space: nowrap;
}

.cal-day.outside {
  color: var(--muted-2);
  opacity: 0.38;
}

.cal-day.today .cal-solar {
  color: var(--accent);
  font-weight: 700;
}

.cal-day.today::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, transparent);
  border-radius: 11px;
  pointer-events: none;
}

.cal-day.selected {
  border-color: transparent;
  background: linear-gradient(140deg, #ffd28a, #ff9a7c 50%, #ff87a5);
  box-shadow: 0 6px 20px rgba(255, 128, 126, 0.24);
  color: #24140a;
}

.cal-day.selected .cal-solar {
  color: #24140a;
  font-weight: 700;
}

.cal-day.selected .cal-lunar {
  color: rgba(36, 20, 10, 0.62);
}

.cal-day.selected.today::before {
  display: none;
}

.cal-day.has-events::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent-2);
  transform: translateX(-50%);
  box-shadow: 0 0 5px var(--accent-2);
}

.cal-day.selected.has-events::after {
  background: #4b2410;
  box-shadow: none;
}

.calendar-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 11px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.selected-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-date > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.selected-date strong {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.selected-date span {
  font-size: 10px;
  color: var(--muted-2);
}

.lunar-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  font-size: 9px !important;
  color: var(--muted) !important;
  letter-spacing: 0.04em;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 39px;
  max-height: 72px;
  margin-top: 9px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.event-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  font-size: 10.5px;
  color: var(--muted-2);
}

.event-empty::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
}

.event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--panel-soft);
  animation: event-in 0.32s var(--ease-out);
}

@keyframes event-in {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

.event-item time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.event-item p {
  flex: 1;
  margin: 0;
  overflow: hidden;
  font-size: 10.5px;
  color: var(--text-soft);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.event-delete {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  opacity: 0;
  transition: color 0.18s, background 0.18s, opacity 0.18s;
}

.event-item:hover .event-delete,
.event-delete:focus-visible {
  opacity: 1;
}

.event-delete:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.event-delete svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.event-form {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 5px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  transition: border-color 0.2s, background 0.2s;
}

.event-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
  background: var(--field);
}

.event-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 10.5px;
}

.event-form input::placeholder {
  color: var(--muted-2);
}

.time-field {
  position: relative;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--line);
  padding-left: 4px;
}

.time-field input {
  width: 56px;
  padding: 3px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.time-field input::-webkit-calendar-picker-indicator {
  opacity: 0.4;
  cursor: pointer;
}

.add-event {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--accent-ink);
  background: linear-gradient(140deg, #ffd28a, #ff9a7c);
  transition: transform 0.18s, filter 0.18s;
}

.add-event:hover {
  filter: brightness(1.06);
  transform: scale(1.05);
}

.add-event svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* =========================================================
   Quick row
   ========================================================= */

.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.16fr;
  gap: 22px;
  margin-top: 22px;
}

.mini-card {
  min-height: 196px;
  padding: 21px 22px;
  border-radius: 26px;
}

.mini-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.mini-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-icon.warm {
  color: #ffb86b;
  background: rgba(255, 184, 107, 0.09);
  border-color: rgba(255, 184, 107, 0.16);
}

.mini-icon.mint {
  color: var(--mint);
  background: color-mix(in srgb, var(--mint) 9%, transparent);
  border-color: color-mix(in srgb, var(--mint) 16%, transparent);
}

.mini-icon.violet {
  color: var(--accent-3);
  background: color-mix(in srgb, var(--accent-3) 9%, transparent);
  border-color: color-mix(in srgb, var(--accent-3) 17%, transparent);
}

.mini-title h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mini-title p {
  margin: 1px 0 0;
  font-size: 9.5px;
  color: var(--muted-2);
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.segmented button {
  width: 27px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  transition: background 0.18s, color 0.18s;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.active {
  color: var(--accent-ink);
  background: var(--accent);
}

html[data-theme="light"] .segmented button.active {
  color: #fffaf3;
}

.focus-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.focus-ring {
  position: relative;
  width: 112px;
  height: 112px;
  flex-shrink: 0;
}

.focus-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 5;
}

.ring-progress {
  fill: none;
  stroke: url("#focusGradient");
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 35%, transparent));
  transition: stroke-dashoffset 0.4s linear, stroke 0.3s;
}

.focus-time {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.focus-time strong {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.focus-time small {
  margin-top: 4px;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.focus-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.focus-controls .round-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--accent-ink);
  background: linear-gradient(140deg, #ffd28a, #ff9a7c);
  box-shadow: 0 7px 20px rgba(255, 147, 111, 0.22);
  transition: transform 0.18s, filter 0.18s;
}

html[data-theme="light"] .focus-controls .round-button {
  color: #fffaf3;
}

.focus-controls .round-button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.focus-controls .round-button:active {
  transform: scale(0.94);
}

.focus-controls .round-button.ghost {
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.focus-controls .round-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.focus-controls .round-button.ghost svg {
  width: 13px;
  height: 13px;
}

.focus-count {
  font-size: 8.5px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.focus-card.is-running .ring-progress {
  animation: ring-glow 2s ease-in-out infinite;
}

@keyframes ring-glow {
  0%, 100% { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 30%, transparent)); }
  50% { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 58%, transparent)); }
}

/* Todo */

.progress-badge {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 73px;
  max-height: 96px;
  margin: 12px 0 6px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 29px;
  padding: 3px 4px;
  border-radius: 8px;
  transition: background 0.18s;
  animation: event-in 0.3s var(--ease-out);
}

.todo-item:hover {
  background: var(--panel-soft);
}

.todo-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: transparent;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.todo-check svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.todo-item.done .todo-check {
  border-color: transparent;
  color: var(--accent-ink);
  background: linear-gradient(140deg, #ffd28a, #ff9a7c);
}

html[data-theme="light"] .todo-item.done .todo-check {
  color: #fffaf3;
}

.todo-text {
  flex: 1;
  overflow: hidden;
  font-size: 10.5px;
  color: var(--text-soft);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.todo-item.done .todo-text {
  color: var(--muted-2);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted-2) 50%, transparent);
}

.todo-remove {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.18s, color 0.18s;
}

.todo-item:hover .todo-remove,
.todo-remove:focus-visible {
  opacity: 1;
}

.todo-remove:hover {
  color: var(--danger);
}

.todo-remove svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.todo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 67px;
  font-size: 10px;
  color: var(--muted-2);
}

.todo-form {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 3px 4px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  transition: border-color 0.18s;
}

.todo-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
}

.todo-form input {
  flex: 1;
  min-width: 0;
  padding: 3px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 10px;
}

.todo-form input::placeholder {
  color: var(--muted-2);
}

.todo-form button {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-hover);
  transition: color 0.18s, background 0.18s;
}

.todo-form button:hover {
  color: var(--accent);
}

.todo-form button svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Quote */

.quote-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 92% 0%, rgba(139, 123, 255, 0.2), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(255, 122, 158, 0.1), transparent 55%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.05), transparent 48%),
    var(--panel);
  overflow: hidden;
}

html[data-theme="light"] .quote-card {
  background:
    radial-gradient(circle at 92% 0%, rgba(139, 123, 255, 0.15), transparent 52%),
    radial-gradient(circle at 0% 100%, rgba(255, 122, 158, 0.09), transparent 55%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.55), transparent 48%),
    var(--panel);
}

.quote-halo {
  position: absolute;
  right: -48px;
  top: -58px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid rgba(139, 123, 255, 0.16);
  box-shadow: inset 0 0 45px rgba(139, 123, 255, 0.12);
  pointer-events: none;
}

.quote-halo::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px dashed rgba(139, 123, 255, 0.14);
  border-radius: 50%;
}

.quote-refresh {
  position: relative;
  z-index: 1;
}

.quote-refresh svg {
  transition: transform 0.4s var(--ease-out);
}

.quote-refresh:hover svg {
  transform: rotate(90deg);
}

.quote-card blockquote {
  position: relative;
  z-index: 1;
  margin: 14px 0 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.68;
  letter-spacing: 0.01em;
  color: var(--text-soft);
}

.quote-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 9px;
  color: var(--muted-2);
}

.quote-index {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

/* =========================================================
   Arcade
   ========================================================= */

.arcade {
  margin-top: 96px;
  scroll-margin-top: 90px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(32px, 3.4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.section-head h2 span {
  margin-left: 12px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}

.section-head > p {
  max-width: 380px;
  margin: 0 0 4px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  text-align: right;
}

.arcade-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 680px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    radial-gradient(circle at 80% 10%, rgba(139, 123, 255, 0.08), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}

html[data-theme="light"] .arcade-shell {
  background:
    radial-gradient(circle at 80% 10%, rgba(139, 123, 255, 0.08), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.5), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.game-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
}

.game-tab {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  width: 100%;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  text-align: left;
  transition: background 0.22s, border-color 0.22s, transform 0.22s;
}

.game-tab:hover {
  background: var(--panel-soft);
}

.game-tab.active {
  border-color: var(--line);
  background: var(--panel-hover);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

html[data-theme="light"] .game-tab.active {
  box-shadow: 0 10px 28px rgba(92, 79, 65, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.game-tab:active {
  transform: scale(0.985);
}

.game-tab-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px solid color-mix(in srgb, var(--tab-accent) 18%, transparent);
  border-radius: 13px;
  color: var(--tab-accent);
  background: color-mix(in srgb, var(--tab-accent) 8%, transparent);
  transition: background 0.22s, transform 0.22s;
}

.game-tab.active .game-tab-icon {
  background: color-mix(in srgb, var(--tab-accent) 15%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--tab-accent) 12%, transparent);
}

.game-tab-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-tab-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.game-tab-copy strong {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.game-tab-copy small {
  margin-top: 2px;
  overflow: hidden;
  font-size: 9px;
  color: var(--muted-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.game-best {
  grid-column: 2;
  justify-self: start;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--muted-2);
  background: var(--panel-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: nowrap;
}

.game-tab.active .game-best {
  color: color-mix(in srgb, var(--tab-accent) 72%, var(--text));
  background: color-mix(in srgb, var(--tab-accent) 8%, transparent);
}

.game-nav-note {
  position: relative;
  margin: auto 6px 4px;
  padding: 14px 13px 13px 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 123, 255, 0.14), transparent 60%),
    var(--panel-soft);
}

.note-orb {
  position: absolute;
  top: 17px;
  left: 14px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffd28a, #ff8a9d 58%, #8b7bff);
  box-shadow: 0 0 14px rgba(255, 138, 157, 0.4);
}

.game-nav-note p {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--muted-2);
}

.game-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px 30px 22px;
  border-radius: 26px;
}

.game-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.022), transparent 55%),
    radial-gradient(circle at 95% 100%, rgba(94, 234, 212, 0.035), transparent 45%);
  pointer-events: none;
}

.game-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.game-kicker {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}

.game-head h3 {
  margin: 0;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.game-head-right {
  display: flex;
  align-items: center;
  gap: 11px;
}

.game-stats {
  display: flex;
  gap: 5px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  min-width: 66px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  line-height: 1.25;
}

.stat-chip span {
  font-size: 8.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
}

.stat-chip strong {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.restart-button {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 35px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 10px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.restart-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.restart-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-panels {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
}

.game-panel {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.game-panel[hidden] {
  display: none;
}

.game-panel.active {
  animation: panel-in 0.45s var(--ease-out);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.game-hint {
  max-width: 560px;
  margin: 18px auto 0;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted-2);
  text-align: center;
}

/* ---- Memory ---- */

.memory-wrap {
  position: relative;
  width: min(100%, 430px);
  margin: 0 auto;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  width: 100%;
  perspective: 1200px;
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  perspective: 800px;
}

.memory-inner {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  transform: rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.memory-card.flipped .memory-inner,
.memory-card.matched .memory-inner {
  transform: rotateY(180deg);
}

.memory-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.memory-back {
  border: 1px solid var(--line);
  opacity: 1;
  transition: opacity 0.18s ease 0.15s;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.1), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(139, 123, 255, 0.17), transparent 55%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

html[data-theme="light"] .memory-back {
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.9), transparent 44%),
    radial-gradient(circle at 80% 80%, rgba(139, 123, 255, 0.16), transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(139, 123, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 22px rgba(92, 79, 65, 0.08);
}

.memory-back::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid color-mix(in srgb, var(--accent-3) 14%, transparent);
  border-radius: 11px;
}

.memory-back::after {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  border: 1px dashed color-mix(in srgb, var(--accent-3) 18%, transparent);
  border-radius: 50%;
  animation: orbit 30s linear infinite reverse;
}

.memory-back span {
  position: relative;
  z-index: 1;
  font-size: 16px;
  color: color-mix(in srgb, var(--accent-3) 75%, var(--text));
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent-3) 38%, transparent);
}

.memory-front {
  opacity: 0;
  transition: opacity 0.18s ease 0.15s;
  border: 1px solid color-mix(in srgb, var(--card-color) 28%, var(--line));
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--card-color) 17%, transparent), transparent 62%),
    var(--panel-strong);
  transform: rotateY(180deg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.14);
}

.memory-front svg {
  width: 38%;
  height: 38%;
  fill: none;
  stroke: var(--card-color);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--card-color) 32%, transparent));
}

.memory-card.flipped .memory-front,
.memory-card.matched .memory-front {
  opacity: 1;
}

.memory-card.flipped .memory-back,
.memory-card.matched .memory-back {
  opacity: 0;
}

.memory-card.matched .memory-front {
  border-color: color-mix(in srgb, var(--card-color) 55%, transparent);
  animation: matched-glow 0.7s var(--ease-out);
}

.memory-card.matched {
  pointer-events: none;
}

.memory-card.matched .memory-front::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed color-mix(in srgb, var(--card-color) 24%, transparent);
  border-radius: 11px;
}

.memory-card.wrong .memory-front {
  animation: shake 0.4s var(--ease-soft);
}

@keyframes matched-glow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--card-color) 38%, transparent); }
  100% { box-shadow: 0 0 0 15px transparent; }
}

@keyframes shake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  25% { transform: rotateY(180deg) translateX(-4px); }
  75% { transform: rotateY(180deg) translateX(4px); }
}

.game-overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 56%, transparent);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  animation: overlay-in 0.35s var(--ease-out);
}

.game-overlay[hidden] {
  display: none;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-card {
  width: min(100%, 290px);
  padding: 25px 22px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 184, 107, 0.1), transparent 60%),
    var(--panel-strong);
  box-shadow: var(--shadow-soft);
  text-align: center;
  animation: card-pop 0.4s var(--ease-out);
}

@keyframes card-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.overlay-eyebrow {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.overlay-card h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.overlay-card p {
  margin: 8px 0 17px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.primary-button,
.ghost-button {
  height: 37px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 550;
  transition: transform 0.18s, filter 0.18s, background 0.18s;
}

.primary-button {
  color: var(--accent-ink);
  background: linear-gradient(140deg, #ffd28a, #ff9a7c 60%, #ff8aa1);
  box-shadow: 0 8px 22px rgba(255, 146, 111, 0.22);
}

html[data-theme="light"] .primary-button {
  color: #fffaf3;
}

.primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active {
  transform: scale(0.96);
}

.ghost-button {
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  color: var(--text);
  background: var(--panel-hover);
}

/* ---- 2048 ---- */

.board-wrap {
  width: min(100%, 450px);
  margin: 0 auto;
}

.board-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding: 0 3px;
  font-size: 8.5px;
  color: var(--muted-2);
}

.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 3px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--muted);
}

.game-2048 {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.035), transparent 55%),
    var(--ttt-bg);
  box-shadow: inset 0 2px 16px rgba(0, 0, 0, 0.12);
  touch-action: none;
  outline: none;
}

.game-2048:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), inset 0 2px 16px rgba(0, 0, 0, 0.12);
}

.grid-2048,
.tile-layer {
  position: absolute;
  inset: 11px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 9px;
}

.grid-cell {
  border-radius: 14px;
  background: var(--tile-empty);
}

.tile-layer {
  pointer-events: none;
}

.tile-slot {
  position: relative;
  border-radius: 14px;
}

.tile {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--tile-bg, rgba(255, 255, 255, 0.08));
  color: var(--tile-color, var(--text));
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(18px, 3.6vw, 28px);
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 16px rgba(0, 0, 0, 0.16);
}

.tile.is-new {
  animation: tile-appear 0.24s var(--ease-out);
}

.tile.d3 { font-size: clamp(15px, 3vw, 24px); }
.tile.d4 { font-size: clamp(13px, 2.5vw, 21px); }

.tile.merged {
  animation: tile-merge 0.24s var(--ease-out);
}

@keyframes tile-appear {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes tile-merge {
  0% { transform: scale(1); }
  55% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

.tile[data-value="2"] { --tile-bg: #30364d; --tile-color: #f2f1ec; }
.tile[data-value="4"] { --tile-bg: #3d3f62; --tile-color: #fffaf0; }
.tile[data-value="8"] { --tile-bg: linear-gradient(145deg, #5e59c9, #6d5ce0); --tile-color: #fff; }
.tile[data-value="16"] { --tile-bg: linear-gradient(145deg, #7b5bd6, #9a5cdd); --tile-color: #fff; }
.tile[data-value="32"] { --tile-bg: linear-gradient(145deg, #a85bc9, #c65cba); --tile-color: #fff; }
.tile[data-value="64"] { --tile-bg: linear-gradient(145deg, #d75b9f, #ee6f8b); --tile-color: #fff; }
.tile[data-value="128"] { --tile-bg: linear-gradient(145deg, #ec7a70, #ff9d6e); --tile-color: #29130b; }
.tile[data-value="256"] { --tile-bg: linear-gradient(145deg, #f2a25e, #ffc46d); --tile-color: #29130b; }
.tile[data-value="512"] { --tile-bg: linear-gradient(145deg, #ffc46d, #ffe08e); --tile-color: #29130b; }
.tile[data-value="1024"] { --tile-bg: linear-gradient(145deg, #ffe08e, #b4f3d9); --tile-color: #102c26; }
.tile[data-value="2048"] { --tile-bg: linear-gradient(145deg, #8af0de, #d9ffe9); --tile-color: #072b25; box-shadow: 0 0 24px rgba(94, 234, 212, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.tile[data-value="4096"],
.tile[data-value="8192"] { --tile-bg: linear-gradient(145deg, #fff1b8, #ffb86b); --tile-color: #2b1608; }

html[data-theme="light"] .tile[data-value="2"] { --tile-bg: #eee4da; --tile-color: #71675d; }
html[data-theme="light"] .tile[data-value="4"] { --tile-bg: #ede0c8; --tile-color: #71675d; }
html[data-theme="light"] .tile[data-value="8"] { --tile-bg: #f2b179; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="16"] { --tile-bg: #f59563; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="32"] { --tile-bg: #f67c5f; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="64"] { --tile-bg: #f65e3b; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="128"] { --tile-bg: #edcf72; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="256"] { --tile-bg: #edcc61; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="512"] { --tile-bg: #edc850; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="1024"] { --tile-bg: #edc53f; --tile-color: #fffaf3; }
html[data-theme="light"] .tile[data-value="2048"] { --tile-bg: #edc22e; --tile-color: #fffaf3; box-shadow: 0 0 24px rgba(237, 194, 46, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ---- Snake ---- */

.snake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.snake-board-shell {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
}

#snakeCanvas {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--snake-board);
  box-shadow: inset 0 2px 18px rgba(0, 0, 0, 0.13);
  touch-action: none;
}

.snake-board-shell .game-overlay {
  border-radius: 24px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(2, 34px);
  gap: 5px;
  justify-content: center;
}

.dpad button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-soft);
  transition: color 0.18s, background 0.18s, transform 0.15s;
}

.dpad button:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.dpad button:active {
  transform: scale(0.94);
}

.dpad button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dpad button[data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad button[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad button[data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad button[data-dir="right"] { grid-column: 3; grid-row: 2; }

/* ---- Tic-tac-toe ---- */

.ttt-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 410px);
  margin: 0 auto;
}

.ttt-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-bottom: 12px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  font-size: 10px;
  color: var(--muted);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.ttt-status.thinking .status-dot {
  background: var(--accent-3);
  box-shadow: 0 0 8px var(--accent-3);
  animation: pulse-dot 1s ease-in-out infinite;
}

.ttt-status.win {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.ttt-status.draw {
  color: var(--muted);
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  width: 100%;
  aspect-ratio: 1;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--ttt-bg);
  box-shadow: inset 0 2px 18px rgba(0, 0, 0, 0.1);
}

.ttt-cell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--ttt-cell);
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.ttt-cell:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.ttt-cell:active:not(:disabled) {
  transform: scale(0.97);
}

.ttt-cell:disabled {
  cursor: default;
}

.ttt-cell svg {
  width: 43%;
  height: 43%;
  overflow: visible;
}

.ttt-cell .mark-x {
  fill: none;
  stroke: #ff9a7c;
  stroke-width: 2.8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px rgba(255, 154, 124, 0.28));
  stroke-dasharray: 30;
  animation: draw-mark 0.32s var(--ease-out) forwards;
}

.ttt-cell .mark-o {
  fill: none;
  stroke: var(--mint);
  stroke-width: 2.8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--mint) 28%, transparent));
  stroke-dasharray: 25;
  animation: draw-mark 0.36s var(--ease-out) forwards;
}

@keyframes draw-mark {
  from { stroke-dashoffset: 30; opacity: 0.25; }
  to { stroke-dashoffset: 0; opacity: 1; }
}

.ttt-cell.win {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  animation: ttt-win 0.7s var(--ease-out);
}

@keyframes ttt-win {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 34%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.ttt-legend {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 13px;
  font-size: 9px;
  color: var(--muted-2);
}

.ttt-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ttt-legend i {
  font-style: normal;
  font-size: 14px;
  line-height: 1;
}

.legend-x { color: #ff9a7c; }
.legend-o { color: var(--mint); }
.ttt-tip {
  margin-left: auto;
  font-size: 8.5px;
}

/* =========================================================
   About & footer
   ========================================================= */

.about-strip {
  scroll-margin-top: 100px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 70px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 184, 107, 0.08), transparent 38%),
    var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.about-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}

.about-mark svg {
  width: 18px;
  height: 18px;
}

.about-strip > p {
  flex: 1;
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

.about-strip > p strong {
  color: var(--text-soft);
  font-weight: 600;
}

.about-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.meta-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--muted-2);
}

.site-footer {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 27px 3px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 9px;
  color: var(--muted-2);
}

.footer-quote {
  font-family: var(--font-serif);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.site-footer a {
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--text);
}

/* =========================================================
   Toast + confetti
   ========================================================= */

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 28px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  font-size: 11px;
  color: var(--text-soft);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.28s, transform 0.28s var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 190;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  width: 6px;
  height: 10px;
  top: -20px;
  border-radius: 1px;
  animation: confetti-fall var(--duration, 2.4s) var(--ease-soft) forwards;
  transform: translate3d(0, 0, 0) rotate(0deg);
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(0deg); }
  8% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(var(--spin, 540deg)); }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1180px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
  }

  .weather-panel {
    padding: 24px 22px 22px;
  }

  .weather-main {
    grid-template-columns: 126px minmax(110px, 0.7fr) minmax(180px, 1.05fr);
    gap: 12px;
  }

  .weather-visual { width: 126px; height: 126px; }
  .wx-orb { width: 120px; height: 120px; }
  .wx-art { width: 98px; height: 98px; }

  .arcade-shell {
    grid-template-columns: 258px minmax(0, 1fr);
  }

  .game-stage {
    padding: 24px 24px 20px;
  }

  .game-nav {
    padding: 10px 7px;
  }

  .quick-row {
    gap: 18px;
  }
}

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .weather-panel,
  .calendar-panel {
    min-height: 0;
  }

  .calendar-grid {
    grid-auto-rows: 51px;
  }

  .calendar-panel {
    padding-bottom: 24px;
  }

  .calendar-detail {
    margin-top: 14px;
  }

  .quick-row {
    grid-template-columns: 1fr 1fr;
  }

  .quote-card {
    grid-column: 1 / -1;
    min-height: 168px;
  }

  .arcade-shell {
    grid-template-columns: 1fr;
  }

  .game-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 7px 6px 12px;
  }

  .game-tab {
    grid-template-columns: 37px minmax(0, 1fr);
    column-gap: 8px;
    padding: 9px 8px;
    border-radius: 14px;
  }

  .game-tab-icon {
    width: 37px;
    height: 37px;
    border-radius: 11px;
  }

  .game-tab-icon svg {
    width: 18px;
    height: 18px;
  }

  .game-tab-copy strong {
    font-size: 11px;
  }

  .game-tab-copy small {
    display: none;
  }

  .game-best {
    margin-top: 2px;
    font-size: 7px;
  }

  .game-nav-note {
    display: none;
  }

  .game-stage {
    padding: 24px 26px 22px;
  }

  .game-panels {
    padding-top: 22px;
  }
}

@media (max-width: 760px) {
  .topbar,
  main,
  .site-footer {
    width: calc(100% - 24px);
  }

  .topbar {
    top: 8px;
    height: 58px;
    margin-top: 8px;
    padding: 7px 8px 7px 13px;
    border-radius: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-mark svg {
    width: 18px;
    height: 18px;
  }

  .brand-word {
    font-size: 15px;
  }

  .brand-word i {
    display: none;
  }

  .main-nav {
    display: none;
  }

  .clock span {
    display: none;
  }

  .clock strong {
    font-size: 12px;
  }

  .top-actions {
    gap: 2px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .hero {
    padding-top: 54px;
  }

  .hero-copy {
    padding: 0 4px;
  }

  .hero h1 {
    margin-top: 16px;
    font-size: clamp(38px, 10.5vw, 52px);
    line-height: 1.16;
  }

  .hero-sub {
    margin-top: 14px;
    font-size: 12px;
  }

  .eyebrow {
    gap: 8px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .hero-grid {
    margin-top: 30px;
    gap: 16px;
  }

  .weather-panel {
    padding: 20px 17px 18px;
    border-radius: 26px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .city-search {
    width: 142px;
  }

  .city-search:focus-within {
    width: 164px;
  }

  .city-search input {
    font-size: 11px;
  }

  .city-results {
    width: 210px;
  }

  .weather-main {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 13px;
    margin: 17px 0 18px;
  }

  .weather-visual {
    width: 112px;
    height: 112px;
  }

  .wx-orb {
    width: 108px;
    height: 108px;
  }

  .wx-art {
    width: 89px;
    height: 89px;
  }

  .temp-line span {
    font-size: 64px;
  }

  .temp-line sup {
    margin-top: 5px;
    font-size: 20px;
  }

  .weather-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .metric {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 8px 7px;
  }

  .metric-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }

  .metric-icon svg {
    width: 13px;
    height: 13px;
  }

  .metric small {
    font-size: 8px;
  }

  .metric strong {
    font-size: 10px;
  }

  .hourly-section,
  .weekly-section {
    padding-top: 14px;
  }

  .weekly-list {
    gap: 1px;
  }

  .week-day {
    gap: 4px;
    padding: 6px 0;
  }

  .week-day .day-name {
    font-size: 8.5px;
  }

  .week-icon {
    width: 20px;
    height: 20px;
  }

  .week-temps {
    flex-direction: column;
    gap: 0;
    align-items: center;
    font-size: 8.5px;
  }

  .week-temps strong {
    font-size: 10px;
  }

  .temp-bar {
    width: 24px;
  }

  .calendar-panel {
    padding: 20px 16px 18px;
    border-radius: 26px;
  }

  .calendar-head h2 {
    font-size: 22px;
  }

  .calendar-weekdays {
    margin-top: 14px;
  }

  .calendar-grid {
    grid-auto-rows: 47px;
  }

  .quick-row {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
  }

  .mini-card {
    min-height: 0;
    padding: 19px 18px;
    border-radius: 24px;
  }

  .quote-card {
    grid-column: auto;
    min-height: 172px;
  }

  .focus-ring {
    width: 106px;
    height: 106px;
  }

  .focus-body {
    justify-content: flex-start;
    gap: 26px;
  }

  .arcade {
    margin-top: 66px;
  }

  .section-head {
    display: block;
    margin-bottom: 20px;
    padding: 0 4px;
  }

  .section-head h2 {
    font-size: 33px;
  }

  .section-head h2 span {
    display: block;
    margin: 5px 0 0;
    font-size: 13px;
  }

  .section-head > p {
    margin-top: 10px;
    text-align: left;
    font-size: 10.5px;
  }

  .arcade-shell {
    padding: 7px;
    border-radius: 26px;
  }

  .game-nav {
    display: flex;
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    padding: 6px 5px 10px;
    scrollbar-width: none;
  }

  .game-nav::-webkit-scrollbar {
    display: none;
  }

  .game-tab {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 72px;
    padding: 8px 5px;
    text-align: center;
  }

  .game-tab-copy strong {
    font-size: 9.5px;
  }

  .game-best {
    display: none;
  }

  .game-tab-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .game-stage {
    padding: 17px 12px 15px;
    border-radius: 21px;
  }

  .game-head {
    flex-direction: column;
    gap: 12px;
    padding: 2px 5px 12px;
  }

  .game-head h3 {
    font-size: 21px;
  }

  .game-head-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .game-stats {
    flex: 1;
    min-width: 0;
  }

  .stat-chip {
    min-width: 0;
    flex: 1;
    padding: 5px 7px;
  }

  .stat-chip strong {
    font-size: 10.5px;
  }

  .restart-button span {
    display: none;
  }

  .restart-button {
    width: 34px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
  }

  .game-panels {
    padding-top: 16px;
  }

  .memory-board {
    gap: 8px;
  }

  .memory-face {
    border-radius: 13px;
  }

  .memory-inner {
    border-radius: 13px;
  }

  .memory-back::before {
    inset: 6px;
    border-radius: 9px;
  }

  .memory-back::after {
    width: 34px;
    height: 34px;
  }

  .memory-front svg {
    width: 40%;
    height: 40%;
  }

  .game-2048,
  .ttt-board {
    border-radius: 20px;
    padding: 8px;
  }

  .grid-2048,
  .tile-layer {
    inset: 8px;
    gap: 7px;
  }

  .grid-cell,
  .tile-slot,
  .tile {
    border-radius: 11px;
  }

  #snakeCanvas {
    border-radius: 20px;
  }

  .snake-board-shell .game-overlay {
    border-radius: 20px;
  }

  .game-hint {
    margin-top: 14px;
    font-size: 9px;
    padding: 0 8px;
  }

  .about-strip {
    display: block;
    margin-top: 48px;
    padding: 20px;
    border-radius: 22px;
  }

  .about-mark {
    margin-bottom: 11px;
  }

  .about-meta {
    margin-top: 12px;
    flex-wrap: wrap;
    white-space: normal;
  }

  .site-footer {
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-bottom: 26px;
  }

  .footer-quote {
    order: 3;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .topbar {
    width: calc(100% - 16px);
  }

  main {
    width: calc(100% - 20px);
  }

  .clock {
    display: none;
  }

  .weather-head {
    gap: 8px;
  }

  .city-search {
    width: 124px;
    padding: 0 8px;
  }

  .city-search:focus-within {
    width: 138px;
  }

  .weather-location .live-badge {
    display: none;
  }

  .temp-line span {
    font-size: 58px;
  }

  .condition-line {
    gap: 6px;
  }

  .condition-line strong {
    font-size: 14px;
  }

  .weather-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    flex-direction: row;
    align-items: center;
    gap: 7px;
  }

  .weekly-list {
    overflow-x: auto;
    grid-template-columns: repeat(7, 48px);
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .cal-lunar {
    font-size: 7px;
  }

  .selected-date {
    align-items: flex-start;
  }

  .selected-date > div {
    flex-direction: column;
    gap: 0;
  }

  .lunar-badge {
    margin-top: 2px;
  }

  .game-stage {
    padding-left: 9px;
    padding-right: 9px;
  }

  .game-head {
    padding-left: 4px;
    padding-right: 4px;
  }

  .game-tab {
    width: 66px;
  }

  .overlay-card {
    padding: 21px 17px 18px;
  }

  .overlay-card h4 {
    font-size: 22px;
  }

  .ttt-legend {
    gap: 11px;
    font-size: 8.5px;
  }

  .ttt-tip {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
