* { margin: 0; padding: 0; box-sizing: border-box; }

/* The .content display:flex rule would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fff;
  color: #fff;
}

/* ---------- Navbar ---------- */
.navbar {
  height: 44px;
  background: #fff;
  color: #333;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid #eee;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-bolt { width: 18px; height: 18px; color: #ccc; }
.nav-title { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }

/* ---------- Main test area ---------- */
#area {
  height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  /* Kill the ~300ms double-tap-zoom delay and tap highlight on touch devices:
     both add latency that would corrupt a millisecond measurement. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.screen-start, .screen-result { background: #2b7cd3; }
.screen-wait { background: #d32f3a; }
.screen-go { background: #3ddc68; }

.content { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.middle, .final { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* Lightning bolt (inline SVG). Color is themed per screen. */
.bolt-icon { width: 90px; height: 90px; }
.bolt-icon.start-bolt { color: #9ec9f2; }
.bolt-icon.final-bolt { color: #ffffff; }

/* Clock face (result icon) */
.clock-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: #fff; position: relative;
}
.clock-icon::before, .clock-icon::after {
  content: ""; position: absolute; background: #2b7cd3;
  left: 50%; top: 50%; transform-origin: top left; border-radius: 2px;
}
.clock-icon::before { width: 5px; height: 26px; transform: translate(-50%,0); }
.clock-icon::after  { width: 5px; height: 20px; transform: translate(-50%,0) rotate(120deg); }

.dots { display: flex; gap: 10px; }
.dots span { width: 15px; height: 15px; border-radius: 50%; background: #fff; }

.headline { font-size: 72px; font-weight: 300; line-height: 1.1; }
.sub { font-size: 22px; font-weight: 400; line-height: 1.5; }

.final-label { font-size: 24px; font-weight: 400; }
.final-value { font-size: 88px; font-weight: 300; }
.attempt-list { font-size: 18px; }

.button-row { display: flex; justify-content: center; gap: 14px; margin-top: 8px; }

/* Buttons mirror the reference: solid yellow "Save score" and pale-blue "Try again". */
.btn {
  border: none; border-radius: 4px; padding: 14px 26px;
  font-size: 18px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: #ffd23f; color: #333; }
.btn-primary:hover { background: #ffdc62; }
.btn-danger { background: #e74c3c; color: #fff; font-size: 14px; padding: 8px 18px; }
.btn-danger:hover { background: #c0392b; }

/* ---------- History ---------- */
.history {
  background: #f7f9fb;
  color: #333;
  padding: 40px 20px 60px;
  border-top: 1px solid #e3e8ee;
}
.history-inner { max-width: 860px; margin: 0 auto; }
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 10px;
}
.history-head h2 { font-size: 26px; font-weight: 500; }
.outlier-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: #555; cursor: pointer; user-select: none;
}
.outlier-toggle input { width: 16px; height: 16px; cursor: pointer; }
.outlier-note { font-size: 13px; color: #777; margin-bottom: 12px; min-height: 18px; }

.history-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.history-table th, .history-table td { padding: 12px 16px; text-align: left; font-size: 15px; }
.history-table th { background: #2b7cd3; color: #fff; font-weight: 600; }
.history-table tbody tr:nth-child(even) { background: #f2f6fa; }
.history-table tbody tr:nth-child(odd) { background: #fff; }

.empty { text-align: center; color: #999; margin-top: 24px; font-size: 15px; }

@media (max-width: 600px) {
  .headline { font-size: 44px; }
  .final-value { font-size: 60px; }
  .sub { font-size: 16px; }
  .history-table th, .history-table td { padding: 8px 10px; font-size: 13px; }
}
