:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-alt: #0c1729;
  --panel: rgba(11, 20, 36, 0.82);
  --panel-border: rgba(146, 171, 214, 0.16);
  --text: #f5f8ff;
  --muted: #9eb1cb;
  --accent: #8dd6ff;
  --accent-2: #ffd479;
  --accent-3: #8ff1c2;
  --danger: #ff8fa3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --max-width: 1240px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(141, 214, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 212, 121, 0.12), transparent 24%),
    linear-gradient(180deg, #050a13 0%, #07111f 44%, #0b1525 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(141, 214, 255, 0.15), transparent 24%),
    radial-gradient(circle at 80% 10%, rgba(143, 241, 194, 0.08), transparent 20%),
    radial-gradient(circle at 70% 70%, rgba(255, 212, 121, 0.08), transparent 18%);
  filter: blur(10px);
}

.app-shell {
  position: relative;
  width: min(var(--max-width), calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  margin-bottom: 14px;
  max-width: 10ch;
}

.lede {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chip,
.primary,
.secondary,
.ghost,
.preset,
.zone-remove {
  border-radius: 999px;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.chip,
.ghost,
.preset,
.zone-remove {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.chip,
.primary,
.secondary,
.ghost {
  min-height: 44px;
  padding: 0 16px;
}

.chip:hover,
.primary:hover,
.secondary:hover,
.ghost:hover,
.preset:hover,
.zone-remove:hover {
  transform: translateY(-1px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.clock-panel {
  padding: 24px;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.clock-card {
  position: relative;
  padding: 24px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
}

.clock-time {
  font-size: clamp(3.5rem, 8vw, 7rem);
  letter-spacing: -0.07em;
  line-height: 0.9;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.clock-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  color: var(--muted);
}

.clock-card__toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.clock-card__toolbar .section-label,
.utility-head > .section-label {
  margin-bottom: 0;
}

.utility-grid {
  display: grid;
  gap: 20px;
}

.utility-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.utility-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.utility-time {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(141, 214, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(141, 214, 255, 0.24);
  font-size: 0.84rem;
}

.button-row,
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #b7efff);
  color: #07111f;
  font-weight: 700;
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost {
  color: var(--muted);
}

.focus-trigger {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.preset.active {
  background: rgba(255, 212, 121, 0.16);
  border-color: rgba(255, 212, 121, 0.3);
  color: var(--accent-2);
}

.preset {
  padding: 10px 14px;
}

.timer-input {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  color: var(--muted);
}

.timer-input input,
.world-controls input {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 14px;
}

.timer-input input:focus,
.world-controls input:focus {
  outline: 2px solid rgba(141, 214, 255, 0.3);
  outline-offset: 2px;
}

.lap-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.lap-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.world-panel {
  margin-top: 20px;
  padding: 24px;
}

.content-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.content-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.content-card h2 {
  margin-bottom: 12px;
  font-size: 1.3rem;
  letter-spacing: -0.04em;
}

.content-card p,
.link-list {
  color: var(--muted);
  line-height: 1.7;
}

.content-card a {
  color: var(--text);
  text-decoration: none;
}

.content-card a:hover {
  text-decoration: underline;
}

.link-list {
  margin: 0;
  padding-left: 18px;
}

.faq-panel {
  margin-top: 20px;
  padding: 24px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.faq-item {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-item h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.ad-slot {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px dashed rgba(141, 214, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(141, 214, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
}

.ad-slot__label {
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  color: var(--accent);
}

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

.ad-slot__unit {
  flex: 1 1 320px;
  min-height: 90px;
}

.ad-slot__content h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.ad-slot__content p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.ad-slot__box {
  flex: 0 0 auto;
  min-width: 160px;
  min-height: 90px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(141, 214, 255, 0.24);
  background: rgba(141, 214, 255, 0.08);
  color: var(--accent);
  font-weight: 700;
}

body.is-focus-mode {
  overflow: hidden;
}

body.is-focus-mode .hero,
body.is-focus-mode .world-panel,
body.is-focus-mode .content-grid,
body.is-focus-mode .ad-slot {
  display: none;
}

body.is-focus-mode .app-shell {
  width: min(calc(100vw - 24px), var(--max-width));
  padding: 12px 0 16px;
}

body.is-focus-mode .clock-panel {
  padding: 0;
  grid-template-columns: 1fr;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.is-focus-mode .clock-card,
body.is-focus-mode .stopwatch-card,
body.is-focus-mode .timer-card {
  position: fixed;
  inset: 12px;
  z-index: 20;
  min-height: calc(100vh - 24px);
  width: auto;
  margin: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: clamp(20px, 4vh, 52px);
}

body.is-focus-mode .clock-card {
  justify-content: space-between;
}

body.is-focus-mode .utility-grid {
  display: block;
}

body.is-focus-mode[data-focus-target="clock"] .utility-grid {
  display: none;
}

body.is-focus-mode[data-focus-target="stopwatch"] .clock-card {
  display: none;
}

body.is-focus-mode[data-focus-target="stopwatch"] .timer-card {
  display: none;
}

body.is-focus-mode[data-focus-target="stopwatch"] .utility-head,
body.is-focus-mode[data-focus-target="timer"] .utility-head {
  display: none;
}

body.is-focus-mode[data-focus-target="stopwatch"] .stopwatch-card,
body.is-focus-mode[data-focus-target="timer"] .timer-card {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: clamp(12px, 2vh, 22px);
}

body.is-focus-mode[data-focus-target="stopwatch"] .stopwatch-card {
  grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr);
}

body.is-focus-mode[data-focus-target="timer"] .timer-card {
  grid-template-rows: minmax(0, 1fr) auto auto auto auto minmax(0, 1fr);
}

body.is-focus-mode[data-focus-target="stopwatch"] .stopwatch-card .lap-list {
  max-height: none;
  flex: 1;
}

body.is-focus-mode[data-focus-target="timer"] .clock-card {
  display: none;
}

body.is-focus-mode[data-focus-target="timer"] .stopwatch-card {
  display: none;
}

body.is-focus-mode[data-focus-target="clock"] .clock-card,
body.is-focus-mode[data-focus-target="stopwatch"] .stopwatch-card,
body.is-focus-mode[data-focus-target="timer"] .timer-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

body.is-focus-mode[data-focus-target="clock"] .clock-time {
  font-size: clamp(5rem, 18vw, 10rem);
  text-align: center;
  width: 100%;
  margin: auto 0;
}

body.is-focus-mode[data-focus-target="stopwatch"] .utility-time,
body.is-focus-mode[data-focus-target="timer"] .utility-time {
  font-size: clamp(4rem, 14vw, 8rem);
  text-align: center;
  width: 100%;
  margin: 0;
  align-self: center;
  justify-self: center;
}

body.is-focus-mode .clock-card__toolbar,
body.is-focus-mode .utility-head,
body.is-focus-mode .clock-meta,
body.is-focus-mode .button-row,
body.is-focus-mode .preset-row,
body.is-focus-mode .timer-input,
body.is-focus-mode .lap-list {
  width: min(100%, 780px);
}

body.is-focus-mode .clock-card__toolbar,
body.is-focus-mode .utility-head {
  margin-bottom: 0;
}

body.is-focus-mode .clock-meta {
  justify-content: space-between;
}

body.is-focus-mode[data-focus-target="clock"] .clock-meta {
  opacity: 0.8;
}

body.is-focus-mode .button-row,
body.is-focus-mode .preset-row {
  justify-content: center;
}

body.is-focus-mode .timer-input {
  justify-items: stretch;
}

body.is-focus-mode .lap-list {
  max-height: min(28vh, 240px);
}

body.is-focus-mode .stopwatch-card .lap-list {
  margin-top: 0;
}

body.is-focus-mode .utility-card .status-dot {
  justify-self: center;
}

body.is-focus-mode[data-focus-target="stopwatch"] .button-row,
body.is-focus-mode[data-focus-target="timer"] .button-row,
body.is-focus-mode[data-focus-target="timer"] .preset-row,
body.is-focus-mode[data-focus-target="timer"] .timer-input {
  margin-top: auto;
}

body.is-focus-mode[data-focus-target="stopwatch"] .button-row {
  grid-row: 3;
  margin-top: 0;
}

body.is-focus-mode[data-focus-target="stopwatch"] .lap-list {
  display: none;
}

body.is-focus-mode[data-focus-target="timer"] .preset-row {
  grid-row: 3;
  margin-top: 0;
}

body.is-focus-mode[data-focus-target="timer"] .timer-input {
  grid-row: 4;
  margin-top: 0;
}

body.is-focus-mode[data-focus-target="timer"] .button-row {
  grid-row: 5;
  margin-top: 0;
  margin-bottom: 0;
}

body.is-focus-mode[data-focus-target="stopwatch"] .utility-time {
  grid-row: 2;
}

body.is-focus-mode[data-focus-target="timer"] .utility-time {
  grid-row: 2;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  letter-spacing: -0.04em;
}

.world-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: min(520px, 100%);
}

.world-controls input {
  flex: 1;
}

.zone-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.zone-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 12px;
}

.zone-name {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1.02rem;
}

.zone-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.zone-time {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.zone-remove {
  justify-self: start;
  padding: 8px 12px;
  color: var(--muted);
}

.light {
  color-scheme: light;
  --bg: #eff4fb;
  --bg-alt: #e6edf7;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-border: rgba(31, 53, 84, 0.08);
  --text: #122033;
  --muted: #51647b;
  --accent: #0057a4;
  --accent-2: #9e6500;
  --accent-3: #12754c;
  --shadow: 0 24px 70px rgba(27, 48, 76, 0.14);
}

.light body {
  background:
    radial-gradient(circle at top left, rgba(0, 87, 164, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 196, 98, 0.16), transparent 24%),
    linear-gradient(180deg, #f6f9fd 0%, #edf3fb 40%, #e7eef8 100%);
}

.light .background {
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 87, 164, 0.12), transparent 24%),
    radial-gradient(circle at 80% 10%, rgba(18, 117, 76, 0.08), transparent 20%),
    radial-gradient(circle at 70% 70%, rgba(255, 196, 98, 0.1), transparent 18%);
}

@media (max-width: 980px) {
  .hero,
  .clock-panel {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero,
  .panel-header {
    align-items: stretch;
  }

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

  .content-grid {
    grid-template-columns: 1fr;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .world-controls {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, var(--max-width));
    padding-top: 16px;
  }

  .hero {
    gap: 18px;
  }

  h1 {
    max-width: none;
  }

  .clock-panel,
  .world-panel {
    padding: 16px;
  }

  .clock-card,
  .utility-card {
    padding: 18px;
  }

  .zone-grid {
    grid-template-columns: 1fr;
  }

  .ad-slot__content {
    flex-direction: column;
    align-items: stretch;
  }

  .ad-slot__box {
    min-width: 0;
    width: 100%;
  }

  body.is-focus-mode .clock-card,
  body.is-focus-mode .stopwatch-card,
  body.is-focus-mode .timer-card {
    inset: 8px;
    min-height: calc(100vh - 16px);
  }
}
