:root {
  --bg: #090b10;
  --surface: #1b1f2a;
  --surface-alt: #242936;
  --text: #f5f7fa;
  --muted: #a5adba;
  --accent: #7335E9;
  --accent-hover: #7335E9;
  --light-off: #2F2D36;
  --light-on: #BDEB2F;
  --light-fail: #EF3F49;
  --ok: #57d66b;
  --border: #2d3342;
  --font-ui: -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  animation: none !important;
  transition: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background: radial-gradient(circle at top, #121621 0%, var(--bg) 55%);
  color: var(--text);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

body.game-active {
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  text-align: center;
}

#home-screen.active {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 20px;
  padding: 20px;
  text-align: center;
}

.start-button,
.secondary-button,
.ghost-button,
.icon-button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.start-button {
  min-width: 220px;
  padding: 18px 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.summary-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

#game-screen.active {
  display: block;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

.top-bar {
  position: absolute;
  top: clamp(18px, 5vw, 32px);
  left: clamp(18px, 5vw, 42px);
  right: clamp(18px, 5vw, 42px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}

.pause-icon {
  width: 14px;
  height: 14px;
  position: relative;
  display: inline-block;
}

.pause-icon::before,
.pause-icon::after {
  content: "";
  position: absolute;
  top: 0;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--text);
}

.pause-icon::before {
  left: 0;
}

.pause-icon::after {
  right: 0;
}

.round-indicator {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.hold-area {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(22px, 4vw, 36px);
  padding: 110px 20px 80px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.status-text {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
}

.lights {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.light {
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: var(--light-off);
  box-shadow: none;
}

.light.on {
  background: var(--light-on);
  box-shadow: none;
}

.light.fail {
  background: var(--light-fail);
  box-shadow: none;
}

.light.success {
  background: var(--ok);
  box-shadow: none;
}

.round-result {
  margin: 0;
  min-height: 28px;
  color: var(--muted);
  font-weight: 700;
}

.round-result.fail {
  color: var(--light-fail);
}

.round-result.ok {
  color: var(--ok);
}

.summary-card {
  width: min(640px, 100%);
  padding: 24px;
}

#summary-screen.active {
  display: grid;
  min-height: 100vh;
  place-content: center;
  padding: 20px;
}

.summary-main {
  color: var(--ok);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 800;
  margin: 8px 0 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-value {
  font-weight: 700;
}

.attempts-title {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.attempts-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.summary-actions,
.modal-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-button,
.ghost-button {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
}

.secondary-button {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.68);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(400px, 100%);
  padding: 20px;
}

.modal-card h2 {
  margin: 0 0 12px;
}

@media (max-width: 640px) {
  .hold-area {
    padding: 92px 14px 70px;
  }

  .light {
    width: 64px;
    height: 64px;
  }

  .lights {
    gap: 10px;
  }
}
