:root {
  --page-top: #eceef3;
  --page-bottom: #d9dce4;
  --wall-a: #2d3a6b;
  --wall-b: #b4566e;
  --wall-c: #12162b;
  --glass: rgba(34, 38, 54, 0.52);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --tile: rgba(255, 255, 255, 0.12);
  --tile-on: #f3f4f8;
  --ink: #f5f6fa;
  --ink-soft: rgba(245, 246, 250, 0.62);
  --ink-on: #151826;
  --accent: #6e8bff;
  --fill: #f5f6fa;
  --pointer: #ffffff;
  --phone-w: min(300px, 80vw, 52vh);
  --phone-h: min(610px, 92vh, calc(80vw * 2.03));
}

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

html, body { height: 100%; }

body {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, var(--page-top), var(--page-bottom));
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.phone {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  border-radius: calc(var(--phone-w) * 0.15);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(20, 22, 34, 0.9),
    0 0 0 calc(var(--phone-w) * 0.022) #1b1d27,
    0 0 0 calc(var(--phone-w) * 0.026) #4a4e5c,
    0 2px 4px rgba(15, 18, 30, 0.12),
    0 18px 36px -12px rgba(15, 18, 30, 0.35),
    0 50px 90px -30px rgba(15, 18, 30, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.wall {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, var(--wall-a) 0%, #563a74 45%, var(--wall-b) 78%, #e3a072 100%);
  z-index: -2;
}
.wall__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.7;
}
.wall__glow--a { width: 70%; height: 40%; left: -10%; top: 8%; background: #5c7bff; }
.wall__glow--b { width: 80%; height: 45%; right: -25%; bottom: -8%; background: #ffb07a; opacity: 0.55; }
.wall::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.25;
}

.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(var(--phone-w) * 0.13);
  padding: 0 calc(var(--phone-w) * 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: calc(var(--phone-w) * 0.047);
  font-weight: 600;
  z-index: 5;
}
.bar__icons { display: flex; gap: 5px; align-items: center; }
.bar__icons svg { height: calc(var(--phone-w) * 0.036); width: auto; fill: currentColor; }

.home {
  position: absolute;
  left: 0; right: 0;
  top: 18%;
  text-align: center;
}
.home__date { font-size: calc(var(--phone-w) * 0.052); font-weight: 500; color: var(--ink-soft); }
.home__clock {
  font-size: calc(var(--phone-w) * 0.27);
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 2px;
}

.handle {
  position: absolute;
  top: calc(var(--phone-w) * 0.1);
  right: calc(var(--phone-w) * 0.06);
  width: calc(var(--phone-w) * 0.3);
  height: calc(var(--phone-w) * 0.1);
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: 6;
}
.handle__bar {
  width: 52%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
}

.shade {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 24, 0.35);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

.cc {
  position: absolute;
  left: 5%;
  right: 5%;
  top: calc(var(--phone-w) * 0.15);
  padding: calc(var(--phone-w) * 0.045);
  border-radius: calc(var(--phone-w) * 0.1);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 50px -20px rgba(5, 8, 20, 0.6);
  z-index: 3;
  will-change: transform;
}
.cc__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 40%);
  pointer-events: none;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--phone-w) * 0.03);
}

.tile {
  position: relative;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.tile__body {
  display: flex;
  align-items: center;
  gap: calc(var(--phone-w) * 0.028);
  height: calc(var(--phone-w) * 0.17);
  padding: 0 calc(var(--phone-w) * 0.032);
  border-radius: calc(var(--phone-w) * 0.06);
  background: var(--tile);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px -8px rgba(0, 0, 0, 0.5);
  transition: background-color 0.35s ease, color 0.35s ease;
  will-change: transform;
  text-align: left;
}
.tile__icon {
  flex: none;
  width: calc(var(--phone-w) * 0.1);
  height: calc(var(--phone-w) * 0.1);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  transition: background-color 0.35s ease;
}
.tile__icon svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile__icon svg circle { fill: currentColor; stroke: none; }
.tile:nth-child(3) .tile__icon svg path,
.tile:nth-child(4) .tile__icon svg path { fill: currentColor; stroke: none; }
.tile__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.tile__name { font-size: calc(var(--phone-w) * 0.044); font-weight: 600; }
.tile__state { font-size: calc(var(--phone-w) * 0.038); color: var(--ink-soft); transition: color 0.35s ease; }
.tile.is-on .tile__body { background: var(--tile-on); color: var(--ink-on); }
.tile.is-on .tile__icon { background: var(--accent); color: #fff; }
.tile.is-on .tile__state { color: rgba(21, 24, 38, 0.58); }

.slider {
  margin-top: calc(var(--phone-w) * 0.035);
  outline: none;
  cursor: grab;
  touch-action: none;
}
.slider__track {
  position: relative;
  display: flex;
  align-items: center;
  height: calc(var(--phone-w) * 0.14);
  border-radius: calc(var(--phone-w) * 0.07);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transform-origin: left center;
  will-change: transform;
}
.slider:focus-visible .slider__track { box-shadow: 0 0 0 2px var(--accent); }
.slider__fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, rgba(245, 246, 250, 0.86), var(--fill));
  transform-origin: left center;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.9), 6px 0 14px -4px rgba(255, 255, 255, 0.4);
  will-change: transform;
}
.slider__icon {
  position: relative;
  margin-left: calc(var(--phone-w) * 0.04);
  width: calc(var(--phone-w) * 0.07);
  height: calc(var(--phone-w) * 0.07);
  color: #5a5f73;
  z-index: 1;
}
.slider__icon svg { width: 100%; height: 100%; overflow: visible; }
.slider__icon--sun circle { fill: currentColor; }
.rays path, .wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.spk { fill: currentColor; }
.rays { transform-origin: 12px 12px; }
.slider__value {
  position: relative;
  margin-left: auto;
  margin-right: calc(var(--phone-w) * 0.05);
  font-size: calc(var(--phone-w) * 0.042);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #4b5064;
  z-index: 1;
}

.cc__hint {
  margin-top: calc(var(--phone-w) * 0.04);
  text-align: center;
  font-size: calc(var(--phone-w) * 0.036);
  color: var(--ink-soft);
}

.pointer {
  position: absolute;
  left: 0; top: 0;
  width: 26px;
  height: 26px;
  fill: var(--pointer);
  stroke: #12141c;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.35));
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}

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