* {
  box-sizing: border-box;
}

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

.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

h1 {
  margin-top: 0;
}

h2 {
  margin-top: 0;
}

h3 {
  margin-bottom: 6px;
}

.muted {
  color: #666;
  font-size: 0.95rem;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid #e6e9ef;
}

.primary {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: #3a6df0;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.primary:disabled {
  background: #9aa8d8;
  cursor: not-allowed;
}

.secondary {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #d0d6e2;
  background: white;
  cursor: pointer;
}

.check {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.input {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border-radius: 6px;
  border: 1px solid #cfd6e4;
}

.timer {
  font-size: 20px;
  margin-bottom: 10px;
}

.word {
  font-size: 28px;
  font-weight: bold;
  margin: 14px 0;
  text-align: center;
}

#tapArena {
  position: relative;
  height: 300px;
  border: 2px dashed #d5d9e6;
  border-radius: 10px;
  margin: 20px 0;
  background: white;
}

#tapTarget {
  position: absolute;
  width: 42px;
  height: 42px;
  background: #3a6df0;
  border-radius: 50%;
}

.actions {
  margin-top: 20px;
}

.actions button {
  margin-top: 10px;
}

.data-summary {
  max-height: 300px;
  overflow-y: auto;
}

/* Segmented buttons (context page) */

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.seg button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #d0d6e2;
  background: white;
  cursor: pointer;
}

.seg button.active {
  background: #3a6df0;
  color: white;
  border-color: #3a6df0;
}

/* Better spacing for context dropdowns */

label.muted {
  margin-top: 10px;
  display: block;
}

/* Instructions page visual improvement */

#screen-instructions .card h2 {
  font-size: 18px;
}

#screen-instructions .card {
  background: #ffffff;
}

/* Results layout */

#pidDisplay {
  font-family: monospace;
}