:root {
  --paper: #f2f0e9;
  --ink: #1c1c1a;
  --muted: #77766f;
  --line: #cac7bd;
  --red: #ef4c2f;
  --red-dark: #d93b21;
  --white: #fffdf8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(28, 28, 26, .025) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 6px;
  font-family: "Noto Sans JP", sans-serif;
  min-height: 100vh;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.site-header {
  height: 72px;
  padding: 0 clamp(24px, 5vw, 80px);
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
}

.header-label,
.eyebrow,
.section-title-row h2,
footer {
  font-family: "DM Mono", monospace;
  letter-spacing: .13em;
}

.header-label {
  color: var(--muted);
  font-size: 11px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--line);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.language-button {
  padding: 5px 2px;
  border: 0;
  color: var(--muted);
  background: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.language-button:hover,
.language-button.active {
  color: var(--red);
}

.language-button.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
}

.watch {
  padding: 16px 0 24px;
  display: grid;
  grid-template-columns: minmax(250px, .7fr) minmax(580px, 1.3fr);
  gap: clamp(40px, 8vw, 130px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  font-weight: 500;
}

.eyebrow span,
.section-title-row h2 span {
  color: var(--red);
  margin-right: 15px;
}

h1 {
  font-size: clamp(43px, 4vw, 66px);
  line-height: 1.35;
  letter-spacing: -.05em;
  margin: 0 0 18px;
}

.intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
  margin: 0;
}

.timer-area {
  min-width: 0;
}

.status-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#status,
.sound-button {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: .12em;
}

#status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}

.status-dot {
  background: var(--muted);
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
}

#status.running .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(239, 76, 47, .12);
  animation: pulse 1.4s infinite;
}

.sound-button,
.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 7px 0 7px 10px;
  cursor: pointer;
}

.sound-button:hover,
.text-button:hover {
  color: var(--red);
}

.sound-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sound-icon {
  width: 18px;
  height: 18px;
  fill: var(--red);
  stroke: var(--red);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-wave {
  fill: none;
}

.sound-off-icon,
.sound-button.off .sound-on-icon {
  display: none;
}

.sound-button.off .sound-off-icon {
  display: block;
}

.time-display {
  font-family: "DM Mono", monospace;
  font-size: clamp(55px, 6.5vw, 102px);
  font-weight: 300;
  letter-spacing: -.085em;
  line-height: 1;
  padding: 32px 0 36px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.milliseconds {
  color: var(--red);
  font-size: .42em;
  letter-spacing: -.05em;
  margin-left: .15em;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.control {
  height: 70px;
  border: 1px solid var(--ink);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: transform .14s, background .14s, color .14s, opacity .14s;
}

.control:not(:disabled):hover {
  background: var(--ink);
  color: var(--white);
  transform: translateY(-2px);
}

.control:not(:disabled):active {
  transform: translateY(1px);
}

.control.primary {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
}

.control.primary:hover {
  background: var(--red-dark);
}

.control:disabled {
  cursor: not-allowed;
  background: #dedbd2;
  color: #77766f;
  opacity: .75;
}

.button-index {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  opacity: .65;
  border: 1px solid currentColor;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 2px;
}

.button-index-wide {
  width: auto;
  min-width: 38px;
  padding: 0 5px;
}

.shortcut-hint {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: .08em;
  margin: 10px 0 0;
  text-align: center;
}

.laps-section {
  border-top: 1px solid var(--ink);
  min-height: 190px;
  padding: 20px 0 34px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-row h2 {
  margin: 0;
  font-size: 11px;
}

.text-button {
  font-size: 11px;
}

.laps-table-wrap {
  margin-top: 20px;
  max-height: 315px;
  overflow-y: auto;
  border-bottom: 1px solid var(--ink);
}

.ad-section {
  width: 100%;
  min-height: 100px;
  padding: 16px 0 22px;
  border-top: 1px solid var(--line);
  text-align: center;
  overflow: hidden;
}

.ad-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: .16em;
}

.adsbygoogle {
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .12em;
  text-align: right;
  padding: 11px 20px;
  border-bottom: 1px solid var(--ink);
  position: sticky;
  top: 0;
  background: var(--paper);
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  padding: 17px 20px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 500;
}

tr.fastest td {
  color: #188354;
}

tr.slowest td {
  color: var(--red);
}

footer {
  min-height: 72px;
  padding: 0 clamp(24px, 5vw, 80px);
  border-top: 1px solid var(--ink);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
}

@keyframes pulse {
  50% { opacity: .45; }
}

@media (max-width: 900px) {
  .watch {
    grid-template-columns: 1fr;
    gap: 38px;
    padding-top: 36px;
  }

  .watch-heading br:first-of-type {
    display: none;
  }

  .timer-area {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .site-header {
    height: 64px;
  }

  .header-label {
    display: none;
  }

  main {
    padding: 0 18px;
  }

  .watch {
    min-height: auto;
    padding: 28px 0 22px;
    gap: 28px;
  }

  h1 {
    font-size: 42px;
  }

  .time-display {
    font-size: clamp(47px, 14.5vw, 72px);
    padding: 24px 0 26px;
  }

  .controls {
    grid-template-columns: 1fr 1.25fr 1fr;
    gap: 7px;
  }

  .control {
    height: 62px;
    gap: 7px;
    font-size: 12px;
  }

  .button-index,
  .shortcut-hint {
    display: none;
  }

  th,
  td {
    padding-left: 8px;
    padding-right: 8px;
  }

  footer {
    padding: 20px 18px;
    min-height: 84px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
  }
}
