:root {
  color-scheme: dark;
  --ink: #f4efe5;
  --muted: #a7a399;
  --panel: #151816;
  --panel-light: #1b1f1c;
  --line: rgba(244, 239, 229, 0.14);
  --lime: #cbff2e;
  --orange: #ff6b35;
  --red: #ff4d45;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #0d100e;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% 8%, rgba(203, 255, 46, 0.08), transparent 25rem),
    linear-gradient(135deg, #0b0e0c 0%, #111512 60%, #0b0d0c 100%);
  font-family:
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 32px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: end;
  gap: 40px;
  padding: 28px 0 50px;
}

.eyebrow,
.section-label {
  color: var(--lime);
  font-family: "Arial Narrow", "Roboto Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.hero .eyebrow {
  position: absolute;
  top: 0;
  left: 3px;
}

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

h1 {
  margin-bottom: 0;
  font-family: "Arial Black", "Yu Gothic", sans-serif;
  font-size: clamp(3.6rem, 9vw, 7.6rem);
  line-height: 0.82;
  letter-spacing: -0.08em;
}

h1 span {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}

.lead {
  max-width: 390px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.9;
}

.trainer-card,
.history-section {
  border: 1px solid var(--line);
  background: rgba(21, 24, 22, 0.92);
  box-shadow: var(--shadow);
}

.trainer-card {
  overflow: hidden;
}

.card-head,
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 30px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  margin-bottom: 7px;
}

.card-head h2,
.history-head h2,
.info-card h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.trial-counter {
  color: var(--lime);
  font-family: "Arial Black", sans-serif;
  font-size: 2.5rem;
  line-height: 1;
}

.trial-counter small {
  color: var(--muted);
  font-size: 0.85rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.mode-button {
  display: grid;
  gap: 5px;
  padding: 17px 24px;
  color: var(--muted);
  border: 0;
  background: var(--panel);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.mode-button span {
  font-weight: 800;
}

.mode-button small {
  font-size: 0.72rem;
}

.mode-button.active {
  color: #10130f;
  background: var(--lime);
}

.viewport-wrap {
  padding: 32px;
}

.viewport {
  position: relative;
  height: clamp(310px, 48vw, 500px);
  overflow: hidden;
  border: 1px solid #303630;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #090b0a;
  background-size: 28px 28px;
  perspective: 620px;
}

.depth-lines {
  position: absolute;
  inset: 62% -10% -35%;
  background:
    repeating-linear-gradient(90deg, transparent 0 8.8%, rgba(203, 255, 46, 0.11) 9% 9.2%),
    repeating-linear-gradient(0deg, transparent 0 17%, rgba(203, 255, 46, 0.08) 17.2% 17.6%);
  transform: rotateX(68deg);
  transform-origin: center top;
}

.target-line {
  position: absolute;
  top: 73%;
  left: 15%;
  width: 70%;
  border-top: 1px dashed rgba(203, 255, 46, 0.24);
}

.rod {
  position: absolute;
  top: 50%;
  width: clamp(25px, 4.2vw, 45px);
  height: 58%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.1) 18%, transparent 49%),
    linear-gradient(90deg, #acb1aa, #f0eee5 47%, #7a7f79);
  box-shadow:
    0 22px 32px rgba(0, 0, 0, 0.55),
    inset -5px 0 8px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
}

.rod::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: -22px;
  width: 80%;
  height: 34px;
  background: rgba(0, 0, 0, 0.32);
  filter: blur(7px);
  transform: skewX(-18deg);
}

.rod-left {
  left: 29%;
}

.moving-rod {
  left: 50%;
  z-index: 2;
  border-color: rgba(203, 255, 46, 0.56);
  will-change: transform, filter;
}

.rod-right {
  left: 71%;
}

.viewport-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.78);
  pointer-events: none;
}

.instruction {
  margin: 22px 0 16px;
  color: var(--muted);
  text-align: center;
}

.stop-button,
.restart-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 18px 28px;
  color: #11140f;
  border: 0;
  background: var(--lime);
  box-shadow: 0 8px 30px rgba(203, 255, 46, 0.13);
  font-size: 1.16rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.stop-button:hover,
.restart-button:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.stop-button:active,
.restart-button:active {
  transform: translateY(1px);
}

.stop-button:disabled {
  color: #777b72;
  background: #30352f;
  box-shadow: none;
  cursor: default;
  transform: none;
}

.stop-icon {
  width: 14px;
  height: 14px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.result-message {
  min-height: 34px;
  padding-top: 14px;
  color: var(--lime);
  font-weight: 800;
  text-align: center;
}

.session-result {
  padding: 34px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(203, 255, 46, 0.09), transparent 52%),
    var(--panel-light);
}

.hidden {
  display: none;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 12px;
}

.score-value {
  font-family: "Arial Black", sans-serif;
  font-size: clamp(3.4rem, 10vw, 6rem);
  line-height: 1;
}

.score-unit {
  color: var(--muted);
  font-size: 1.2rem;
}

.pass-badge {
  padding: 10px 17px;
  color: #10130f;
  background: var(--lime);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.pass-badge.fail {
  color: white;
  background: var(--red);
}

.session-result > p:not(.section-label) {
  color: var(--muted);
}

.attempt-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.attempt-item {
  padding: 15px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.attempt-item small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
}

.attempt-item strong {
  font-size: 1.25rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 18px 0;
}

.info-card {
  position: relative;
  min-height: 200px;
  padding: 29px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.info-card h2 {
  margin-bottom: 18px;
}

.info-card p {
  max-width: 85%;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.85;
}

.info-card strong {
  color: var(--lime);
}

.info-number {
  position: absolute;
  right: 18px;
  bottom: -20px;
  color: rgba(203, 255, 46, 0.07);
  font-family: "Arial Black", sans-serif;
  font-size: 7.5rem;
  line-height: 1;
}

.history-section {
  margin-top: 18px;
}

.clear-button {
  padding: 8px 2px;
  color: var(--muted);
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-size: 0.78rem;
  cursor: pointer;
}

.history-list {
  padding: 12px 30px 24px;
}

.history-entry {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.6fr) minmax(110px, 0.6fr);
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.history-entry:last-child {
  border-bottom: 0;
}

.history-date,
.history-mode {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-score {
  justify-self: end;
  font-weight: 900;
}

.history-score.pass {
  color: var(--lime);
}

.empty-history {
  margin: 14px 0 0;
  padding: 22px 0;
  color: var(--muted);
  text-align: center;
}

footer {
  padding: 30px 4px 0;
  color: #747970;
  font-size: 0.73rem;
  line-height: 1.8;
  text-align: center;
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 34px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 36px;
  }

  h1 {
    font-size: clamp(3.45rem, 19vw, 5.8rem);
  }

  .lead {
    max-width: 32rem;
  }

  .card-head,
  .history-head {
    padding: 20px;
  }

  .mode-button {
    padding: 15px 10px;
  }

  .mode-button small {
    font-size: 0.62rem;
  }

  .viewport-wrap {
    padding: 14px;
  }

  .viewport {
    height: 390px;
  }

  .rod-left {
    left: 24%;
  }

  .rod-right {
    left: 76%;
  }

  .session-result {
    padding: 24px 18px;
  }

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

  .info-card {
    min-height: 180px;
  }

  .history-list {
    padding: 8px 20px 18px;
  }

  .history-entry {
    grid-template-columns: 1fr auto;
    gap: 6px 14px;
  }

  .history-mode {
    grid-column: 1;
  }

  .history-score {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

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