:root {
  --paper: #f4efe6;
  --paper-deep: #ebe3d7;
  --ink: #17130f;
  --muted: #6a6255;
  --accent: #b94b31;
  --accent-soft: rgba(185, 75, 49, 0.14);
  --line: rgba(23, 19, 15, 0.12);
  --line-strong: rgba(23, 19, 15, 0.26);
  --panel: rgba(255, 255, 255, 0.46);
  --panel-strong: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 60px rgba(40, 29, 21, 0.08);
  --radius: 28px;
  --radius-sm: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Work Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 36%),
    radial-gradient(circle at bottom right, rgba(185, 75, 49, 0.07), transparent 28%),
    linear-gradient(145deg, #f8f4ed 0%, var(--paper) 45%, var(--paper-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 79px,
      rgba(23, 19, 15, 0.035) 79px,
      rgba(23, 19, 15, 0.035) 80px
    );
  opacity: 0.55;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(23, 19, 15, 0.06) 0.6px, transparent 0.6px),
    radial-gradient(rgba(23, 19, 15, 0.03) 0.8px, transparent 0.8px);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
  opacity: 0.12;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  position: relative;
  width: min(1380px, calc(100% - 32px));
  margin: 20px auto 56px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.38)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 38%);
  pointer-events: none;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: panel-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.hero {
  padding: clamp(28px, 4vw, 48px);
  margin-bottom: 20px;
}

.hero-strip,
.panel-head,
.slot-head,
.clock-toolbar,
.inline-actions,
.chart-toolbar,
.planner-actions,
.range-labels,
.hero-tags,
.result-footer,
.result-meta,
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-strip {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.panel-index,
.result-eyebrow,
.meeting-zone,
.clock-city,
.clock-zone,
.live-pill,
.day-chip,
.micro-note,
.field span,
.field-label {
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow,
.panel-index,
.micro-note,
.clock-city,
.clock-zone,
.meeting-zone,
.field span,
.field-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.live-pill,
.day-chip {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  padding-top: 28px;
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.panel-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.hero h1 {
  font-size: clamp(3.4rem, 8vw, 6.8rem);
  line-height: 0.96;
}

.hero-text {
  max-width: 50rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.75;
}

.hero-tags {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 26px;
}

.hero-tags span,
.band-card,
.slot-item,
.meeting-card,
.clock-card,
.result-card,
.table-shell,
.converter-form,
.ghost-button,
.solid-button,
.segmented,
.field input,
.search-field input {
  border: 1px solid var(--line);
}

.hero-tags span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 100%;
}

.hero-figure::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 0;
  width: 120px;
  height: 120px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
}

.hero-number {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(6rem, 18vw, 11rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.hero-caption {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: right;
  line-height: 1.7;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.converter,
.chart {
  grid-column: span 7;
}

.clocks,
.planner {
  grid-column: span 5;
}

.converter,
.clocks,
.chart,
.planner {
  padding: clamp(22px, 3vw, 34px);
}

.panel-head {
  align-items: flex-start;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel-head h2 {
  font-size: clamp(1.8rem, 2.8vw, 2.45rem);
}

.converter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.converter-form,
.result-card,
.clock-card,
.band-card,
.meeting-card,
.slot-item {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.44);
}

.converter-form {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.field,
.field-block {
  display: grid;
  gap: 8px;
}

.field input,
.search-field input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  outline: none;
}

.field input:focus,
.search-field input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(23, 19, 15, 0.05);
}

.time-stack {
  display: grid;
  gap: 10px;
}

.time-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: end;
}

.time-field input {
  text-align: center;
  font-family: "Azeret Mono", monospace;
  font-size: 1.2rem;
  letter-spacing: -0.08em;
}

.time-colon {
  align-self: center;
  padding-bottom: 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 2rem;
}

.segmented {
  padding: 5px;
  border-radius: 999px;
  background: rgba(23, 19, 15, 0.05);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.segmented button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.segmented button.is-active {
  background: var(--ink);
  color: #fdfaf5;
  transform: translateY(-1px);
}

.direction-switch button {
  font-size: 0.95rem;
}

.ghost-button,
.solid-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
}

.solid-button {
  background: var(--ink);
  color: #fdfaf5;
}

.ghost-button:hover,
.solid-button:hover,
.clock-card:hover,
.slot-item:hover {
  transform: translateY(-1px);
}

.result-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

.result-eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
}

.result-meta {
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-time,
.clock-time,
.meeting-time {
  font-family: "Azeret Mono", monospace;
  letter-spacing: -0.08em;
}

.result-time {
  margin: 18px 0 10px;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 1;
}

.result-date {
  color: var(--muted);
  line-height: 1.6;
}

.result-footer {
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: space-between;
}

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

.clock-card {
  padding: 22px;
  text-align: left;
  background: rgba(255, 255, 255, 0.42);
}

.clock-zone {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.clock-time {
  display: block;
  margin-top: 22px;
  font-size: clamp(1.85rem, 3.5vw, 3.2rem);
}

.clock-date {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.clock-toolbar {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.chart-toolbar,
.planner-range-wrap,
.planner-bands,
.slot-block {
  display: grid;
  gap: 14px;
}

.search-field {
  max-width: 420px;
}

.table-shell {
  overflow: auto;
  max-height: 488px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 16px 18px;
  background: rgba(244, 239, 230, 0.9);
  backdrop-filter: blur(12px);
  text-align: left;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color 180ms ease, transform 180ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.76);
}

tbody tr.is-current {
  background: rgba(23, 19, 15, 0.07);
}

tbody tr.is-match {
  background: var(--accent-soft);
}

tbody tr.is-off-hours {
  color: var(--muted);
}

tbody td {
  padding: 16px 18px;
  border-top: 1px solid rgba(23, 19, 15, 0.08);
}

.table-time {
  font-family: "Azeret Mono", monospace;
  font-size: 0.94rem;
}

.table-note {
  color: var(--muted);
}

.table-note.is-negative {
  color: var(--accent);
}

.panel-tip {
  margin: 14px 2px 0;
  color: var(--muted);
  line-height: 1.7;
}

.planner-range-wrap {
  margin-bottom: 18px;
}

.range-labels {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
}

.planner-range {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(23, 19, 15, 0.12) 0%,
    rgba(23, 19, 15, 0.24) 100%
  );
  outline: none;
}

.planner-range::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fffdfa;
  box-shadow: 0 10px 24px rgba(23, 19, 15, 0.14);
}

.planner-range::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fffdfa;
  box-shadow: 0 10px 24px rgba(23, 19, 15, 0.14);
}

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

.meeting-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease,
    opacity 180ms ease;
}

.meeting-time {
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
}

.meeting-state {
  color: var(--muted);
  line-height: 1.6;
}

.meeting-card.is-active {
  background: rgba(77, 134, 92, 0.16);
  border-color: rgba(77, 134, 92, 0.28);
}

.meeting-card.is-active .meeting-state {
  color: #2f6f41;
}

.meeting-card.is-muted {
  opacity: 0.76;
}

.meeting-card.is-hidden {
  display: none;
}

.planner-bands {
  margin-top: 18px;
}

.band-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.band-card span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.slot-block {
  margin-top: 18px;
}

.slot-list {
  display: grid;
  gap: 10px;
}

.slot-item {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slot-copy {
  color: var(--muted);
  font-size: 0.82rem;
}

.planner-actions {
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(17, 14, 11, 0.92);
  color: #fffdf7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

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

@keyframes panel-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .converter,
  .clocks,
  .chart,
  .planner {
    grid-column: span 12;
  }

  .hero-layout,
  .converter-layout {
    grid-template-columns: 1fr;
  }

  .hero-figure {
    align-items: flex-start;
  }

  .hero-caption {
    text-align: left;
  }
}

@media (max-width: 780px) {
  .page {
    width: min(100% - 20px, 100%);
    margin: 10px auto 28px;
  }

  .hero h1 {
    font-size: clamp(2.7rem, 14vw, 4rem);
  }

  .clocks-grid,
  .meeting-cards {
    grid-template-columns: 1fr;
  }

  .time-fields {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-fields .segmented {
    grid-column: 1 / -1;
  }

  .panel-head,
  .clock-toolbar,
  .chart-toolbar,
  .planner-actions,
  .result-footer,
  .hero-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .slot-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12100d;
    --paper-deep: #0d0b09;
    --ink: #f2eadf;
    --muted: #b7aa99;
    --accent: #d17a5f;
    --accent-soft: rgba(209, 122, 95, 0.18);
    --line: rgba(242, 234, 223, 0.12);
    --line-strong: rgba(242, 234, 223, 0.26);
    --panel: rgba(31, 25, 21, 0.72);
    --panel-strong: rgba(31, 25, 21, 0.84);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(209, 122, 95, 0.08), transparent 28%),
      radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.04), transparent 24%),
      linear-gradient(145deg, #16120f 0%, var(--paper) 45%, var(--paper-deep) 100%);
  }

  body::before {
    background:
      linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 79px,
        rgba(242, 234, 223, 0.03) 79px,
        rgba(242, 234, 223, 0.03) 80px
      );
  }

  body::after {
    opacity: 0.08;
  }

  .panel {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
      var(--panel);
  }

  .hero-tags span,
  .converter-form,
  .result-card,
  .clock-card,
  .band-card,
  .meeting-card,
  .slot-item,
  .table-shell,
  .field input,
  .search-field input,
  .ghost-button,
  .live-pill,
  .day-chip,
  .clock-zone {
    background: rgba(255, 255, 255, 0.04);
  }

  thead th {
    background: rgba(18, 16, 13, 0.92);
  }

  tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  tbody tr.is-current {
    background: rgba(255, 255, 255, 0.08);
  }

  .meeting-card.is-active {
    background: rgba(77, 134, 92, 0.2);
  }

  .meeting-card.is-active .meeting-state {
    color: #97d0a7;
  }
}
