:root {
  /* il giorno: carta calda */
  --fondo: #f4efe6;
  --carta: #fbf8f2;
  --bordo: rgba(32, 24, 16, 0.09);
  --testo: #1d1813;
  --testo-2: #7a7065;
  --testo-3: #b3a99c;
  --binario: #e3dcd0;
  --riga: rgba(32, 24, 16, 0.1);
  /* la notte */
  --notte-fondo: #0c0a0f;
  --notte-carta: #15121a;
  --notte-bordo: rgba(255, 240, 220, 0.08);
  --notte-testo: #f3ece2;
  --notte-testo-2: #9b9184;
  --notte-testo-3: #5a5249;
  --notte-binario: #1e1925;
  --notte-riga: rgba(255, 240, 220, 0.09);
  /* l'accento: arancio zucca */
  --accento: #ff7a1a;
  --luna: #f3ead6;
  --stella: #f3ead6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3.5vmin, 40px);
  background: var(--fondo);
}

.card {
  position: relative;
  width: min(340px, 100%);
  padding: clamp(14px, 3.4vmin, 20px);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(20, 14, 8, 0.05), 0 14px 36px -18px rgba(20, 14, 8, 0.22);
}

/* ---- the header with the app icon: two cut eyes of a pumpkin ---- */
.head { display: flex; align-items: center; gap: 11px; }
.appico { width: 30px; height: 30px; flex: none; }
.appico svg { width: 100%; height: 100%; display: block; overflow: visible; }
.appico__box { fill: none; stroke: var(--riga); stroke-width: 1.3; }
.appico__eyes path { fill: var(--testo-3); }
.appico__eyes { filter: drop-shadow(0 0 0 rgba(255, 122, 26, 0)); }
.head__text { display: flex; flex-direction: column; gap: 1px; }
.head__app { font-size: 13.5px; font-weight: 620; letter-spacing: -0.01em; font-variation-settings: "wdth" 100; }
.head__sub { font-size: 11.5px; color: var(--testo-2); }

/* ---- the row with the switch ---- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: clamp(12px, 3vmin, 18px);
  padding-top: clamp(12px, 3vmin, 16px);
  border-top: 1px solid var(--riga);
}
.row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row__title { font-size: 15px; font-weight: 560; letter-spacing: -0.012em; font-variation-settings: "wdth" 100; display: inline-block; }
.row__hint { height: 16px; overflow: hidden; font-size: 12px; color: var(--testo-2); }
.row__hint span { display: block; white-space: nowrap; }

.sw {
  position: relative;
  flex: none;
  width: 58px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--binario);
  cursor: pointer;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(20, 14, 8, 0.12);
}
.sw:focus-visible { box-shadow: 0 0 0 2px var(--carta), 0 0 0 4px var(--accento); }
.sw__night {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #17121e;
  opacity: 0;
  overflow: hidden;
}
.sw__stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.sw__stars path { stroke: var(--stella); stroke-width: 1; stroke-linecap: round; opacity: 0; }
.sw__knob {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
}
.sw__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 14, 8, 0.2), 0 3px 8px -2px rgba(20, 14, 8, 0.22);
}
.sw__moon { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); opacity: 0; }
.moon__disc { fill: url(#moon-light); }
.moon__mare { fill: rgba(140, 118, 84, 0.2); }
.moon__mare--soft { fill: rgba(140, 118, 84, 0.13); }
.moon__crater circle { fill: rgba(130, 108, 76, 0.2); stroke: rgba(120, 98, 66, 0.32); stroke-width: 0.45; }
.moon__crater path { fill: none; stroke-width: 0.5; stroke-linecap: round; }
.moon__crater path:first-of-type { stroke: rgba(96, 78, 52, 0.42); }
.moon__crater path:last-of-type { stroke: rgba(255, 252, 244, 0.85); }
.moon__terminator { fill: none; stroke: rgba(120, 100, 70, 0.16); stroke-width: 5; }
.moon__rim { fill: none; stroke: rgba(255, 250, 238, 0.55); stroke-width: 0.5; }
.sw__halo {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(243, 234, 214, 0.34), rgba(243, 234, 214, 0.1) 60%, rgba(243, 234, 214, 0) 100%);
  opacity: 0;
  pointer-events: none;
}
.sw__ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(243, 234, 214, 0.7);
  opacity: 0;
  pointer-events: none;
}

/* ---- a small preview of the page under the setting ---- */
.preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: clamp(12px, 3vmin, 16px);
  padding: 12px 13px 13px;
  border-radius: 12px;
  border: 1px solid var(--riga);
}
.preview__time { font-size: 11px; color: var(--testo-2); }
.preview__title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.preview__line { display: block; height: 5px; border-radius: 3px; background: var(--riga); width: 92%; }
.preview__line--short { width: 58%; }

/* ---- the bat: drawn on a canvas over the whole page ---- */
.bats {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #000;
  stroke-width: 1.3;
  stroke-linejoin: round;
  visibility: hidden;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

@media (max-height: 400px) {
  .preview__line--short { display: none; }
}
