* {
  box-sizing: border-box;
}
html {
  color-scheme: light;
}
body {
  margin: 0;
  background: #faf6ed;
  color: #282b23;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Apple SD Gothic Neo",
    sans-serif;
  line-height: 1.6;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button {
  cursor: pointer;
  min-height: 48px;
  border: 1px solid #c9c1af;
  border-radius: 12px;
  background: #fffdf7;
  padding: 10px 18px;
  font-weight: 700;
}
button:hover {
  background: #fff1a0;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
  background: #eae6dd;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #785b00;
}
header {
  max-width: 1280px;
  margin: auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-size: 24px;
  font-weight: 900;
  text-decoration: none;
  color: inherit;
}
.brand span {
  color: #b19500;
}
.badge {
  font-size: 12px;
  letter-spacing: 1px;
  color: #59594f;
}
main {
  max-width: 1232px;
  margin: 16px auto 60px;
  padding: 0 24px;
}
h1 {
  font-size: 40px;
  letter-spacing: -1.5px;
  margin: 4px 0;
}
h2 {
  font-size: 24px;
  line-height: 1.4;
  margin: 0 0 16px;
}
p {
  color: #59594f;
  margin: 8px 0 24px;
}
.nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 24px 0;
}
.nav a {
  text-align: center;
  color: inherit;
  text-decoration: none;
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 12px 6px;
  background: #fffdf7;
  border: 1px solid #c9c1af;
  border-radius: 12px;
  font-weight: 700;
}
.nav a[aria-current="page"] {
  background: #f4d744;
  border-color: #282b23;
  box-shadow: 0 3px #282b23;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
}
.layout.wide {
  grid-template-columns: 1fr;
}
.layout.wide .aside {
  display: none;
}
.panel,
.aside {
  min-width: 0;
  background: #fffdf7;
  border: 1px solid #dcd2bd;
  border-radius: 24px;
  padding: 32px;
}
.aside {
  align-self: start;
  padding: 24px;
}
.aside h2 {
  margin-top: 14px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.muted,
.small {
  color: #59594f;
  font-size: 14px;
}
.hero {
  text-align: center;
  padding: 28px 0;
}
.time-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.1;
  letter-spacing: -0.045em;
  white-space: nowrap;
  font-weight: 800;
}
.time-display .major {
  font-size: clamp(64px, 8vw, 112px);
}
.time-display .minor {
  font-size: clamp(24px, 3vw, 42px);
  letter-spacing: -0.02em;
  margin-left: 0.13em;
  color: #59594f;
}
.time-display .separator {
  letter-spacing: 0;
  margin-right: 0.04em;
}
.mega {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(72px, 12vw, 160px);
  line-height: 1.15;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.mega.long {
  font-size: clamp(50px, 10vw, 132px);
}
.hundredths {
  display: block;
  font-size: 28px;
  letter-spacing: 0;
  color: #777665;
  font-weight: 600;
  margin-top: 8px;
}
.big-face {
  container-type: inline-size;
  text-align: center;
  position: relative;
  padding: 44px 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f8f4e8;
  border-radius: 20px;
}
.big-face .mega {
  font-size: clamp(68px, 28cqw, 204px);
}
.big-face.dark {
  background: #282b23;
  color: #fffdf7;
}
.big-face.dark .muted {
  color: #e2ddcf;
}
.big-face:fullscreen,
.big-face.expanded {
  border-radius: 0;
  background: #282b23;
  color: #fffdf7;
  width: 100%;
  height: 100%;
  max-height: none;
}
.big-face.expanded {
  position: fixed;
  inset: 0;
  z-index: 20;
}
.big-face:fullscreen .mega,
.big-face.expanded .mega {
  font-size: clamp(60px, 28vw, 500px);
}
.exit-full {
  display: none;
  position: absolute;
  right: 20px;
  top: 20px;
}
.big-face:fullscreen .exit-full,
.big-face.expanded .exit-full {
  display: block;
}
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0;
}
.primary {
  background: #f4d744;
  border-color: #282b23;
  box-shadow: 0 3px #282b23;
  min-width: 150px;
}
.city {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid #e4dccb;
}
.city strong {
  font-size: 20px;
}
.city .time {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.city select {
  max-width: 280px;
  margin: 0;
}
.tag {
  display: inline-block;
  background: #f5f0de;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 24px 0;
}
.fields.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 540px;
  margin: 24px auto;
}
.fields.three input {
  text-align: center;
}
label {
  display: block;
  font-weight: 700;
  min-width: 0;
}
input,
select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #b9b19f;
  border-radius: 12px;
  background: white;
  margin-top: 8px;
}
input[type="checkbox"] {
  display: inline-block;
  width: 20px;
  min-height: 20px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}
.note {
  padding: 16px;
  background: #f6f1e4;
  border-radius: 12px;
  font-size: 14px;
}
.error {
  color: #9f332b;
  font-weight: 600;
}
.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.compare-card {
  background: #f8f5ec;
  border: 1px solid #ded6c5;
  border-radius: 18px;
  padding: 24px 16px;
  text-align: center;
}
.compare-card:first-child {
  background: #fff5bc;
  border-color: #dfca6a;
}
.compare-card .value {
  font-weight: 800;
  font-size: clamp(28px, 4.5vw, 60px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.4;
}
.compare-card h3 {
  font-size: 18px;
  margin: 10px 0;
}
.compare-card p {
  margin: 8px 0;
  font-size: 14px;
}
.lap {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid #ddd;
  font-variant-numeric: tabular-nums;
}
.lap-list {
  max-width: 660px;
  margin: auto;
  max-height: 300px;
  overflow: auto;
}
.lap-list h3 {
  font-size: 16px;
}
.inline-settings {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin: 22px 0;
}
.inline-settings select {
  width: auto;
  margin: 0;
}
.inline-settings label {
  display: flex;
  gap: 8px;
  align-items: center;
}
.subtle {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  min-height: 44px;
}
.danger {
  color: #9f332b;
}
#feedback {
  min-height: 28px;
  text-align: center;
  font-weight: 600;
  margin: 20px 0;
  color: #785b00;
}
#active-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 14px;
}
#active-status a {
  color: inherit;
  padding: 5px 12px;
  background: #f3e9b5;
  border-radius: 20px;
}
#ring-banner {
  border: 2px solid #9d7b00;
  background: #fff0a0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
#ring-banner button {
  margin: 8px 8px 0 0;
}
footer {
  border-top: 1px solid #dcd2bd;
  padding-top: 20px;
  color: #59594f;
  font-size: 13px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 800px) {
  header {
    padding: 16px;
  }
  main {
    padding: 0 16px;
    margin-top: 12px;
  }
  h1 {
    font-size: 32px;
  }
  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .nav a {
    font-size: 14px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 24px 18px;
    border-radius: 20px;
  }
  .aside {
    padding: 22px;
  }
  .hero {
    padding: 24px 0;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .fields.three {
    gap: 10px;
  }
  .fields.three input {
    padding: 10px 4px;
  }
  .city .time {
    font-size: 28px;
  }
  .city select {
    max-width: 180px;
  }
  .city {
    gap: 8px;
  }
  .city .tag {
    font-size: 12px;
    padding: 2px 5px;
  }
  .time-display .major {
    font-size: 76px;
  }
  .time-display .minor {
    font-size: 30px;
  }
  .comparison {
    gap: 10px;
  }
  .compare-card {
    padding: 18px 8px;
  }
  .compare-card h3 {
    font-size: 16px;
  }
  .compare-card .value {
    font-size: 36px;
  }
  .compare-card p {
    font-size: 13px;
  }
  .mega {
    font-size: clamp(64px, 23vw, 140px);
  }
  .mega.long {
    font-size: clamp(46px, 12vw, 100px);
  }
  .big-face {
    padding: 34px 8px;
    min-height: 280px;
  }
  .big-face .mega {
    font-size: 28cqw;
  }
  .actions .primary {
    min-width: 140px;
  }
  .badge {
    font-size: 10px;
  }
}
@media (max-width: 360px) {
  .panel {
    padding: 20px 12px;
  }
  .time-display .major {
    font-size: 64px;
  }
  .time-display .minor {
    font-size: 25px;
  }
  .compare-card .value {
    font-size: 30px;
  }
  .city select {
    max-width: 150px;
  }
  .city .time {
    font-size: 24px;
  }
  .actions {
    gap: 8px;
  }
  .actions button {
    padding: 10px 14px;
  }
  .intro p {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
dialog {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid #282b23;
  border-radius: 20px;
  background: #fffdf7;
  color: #282b23;
}
dialog::backdrop {
  background: rgba(40, 43, 35, 0.55);
}
dialog .actions {
  margin-bottom: 0;
}
dialog p {
  overflow-wrap: anywhere;
}

/* Fit the complete HH:MM:SS string to its own container, not the viewport. */
.hero {
  container-type: inline-size;
}
.hero .mega {
  font-size: min(160px, calc(180cqw / var(--digits, 8)));
}
.big-face .mega {
  font-size: min(204px, 22cqw);
}
.big-face:fullscreen .mega,
.big-face.expanded .mega {
  font-size: min(500px, 22cqw);
}
@media (max-width: 600px) {
  .lap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    font-size: 14px;
  }
  .lap strong {
    grid-column: 2;
  }
}
.city-field {
  min-width: 0;
}
.city-picker {
  width: 100%;
  margin-top: 8px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  white-space: normal;
}
.city-picker span {
  font-size: 22px;
}
#city-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: 85dvh;
  padding: 24px;
}
#city-results {
  max-height: 48dvh;
  overflow: auto;
  margin-top: 16px;
  display: grid;
  gap: 6px;
}
#city-results button {
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
#city-results button span {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.language-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.language-control select {
  margin: 0;
  width: auto;
  padding: 8px;
  min-height: 44px;
}
.brand-link {
  font-size: 14px;
  color: inherit;
}
.tool-guide {
  margin: 32px 0;
  padding: 24px;
  border-top: 1px solid #dcd2bd;
}
.tool-guide h2 {
  font-size: 22px;
}
.tool-guide p {
  max-width: 75ch;
}
.language-hint {
  background: #fff1aa;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.comparison .note {
  grid-column: 1/-1;
}
.lap span,
.lap strong {
  overflow-wrap: anywhere;
}
html[lang="en"] .nav a {
  font-size: 14px;
}
html[lang="en"] .fields.three label {
  font-size: 14px;
}
@media (max-width: 600px) {
  header {
    gap: 12px;
  }
  .brand {
    font-size: 22px;
  }
  .language-control {
    gap: 6px;
  }
  .language-control select {
    max-width: 115px;
  }
  .city-picker {
    font-size: 14px;
  }
  .city {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .city-picker span {
    display: none;
  }
  #city-results button {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .inline-settings .city-field {
    width: 100%;
  }
  .nav a {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  html[lang="en"] .nav a {
    overflow-wrap: normal;
    font-size: 13px;
  }
}
