:root {
  --bg-start: #0f172a;
  --bg-end: #1e293b;
  --card: #0b1220;
  --text: #e2e8f0;
  --muted: #b8c2d3;
  --red: #ef4444;
  --blue: #3b82f6;
  --ok: #10b981;
  --bad: #f97316;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, #23345a, var(--bg-start) 45%),
    linear-gradient(140deg, var(--bg-start), var(--bg-end));
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.app {
  width: min(92vmin, 640px);
  padding: 12px;
}

.arena {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  background: var(--card);
}

.half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  border: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.half:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -4px;
}

.half-red {
  left: 0;
  border-radius: 22px 0 0 22px;
  background: linear-gradient(160deg, #ff6978, #d32647 60%);
}

.half-blue {
  right: 0;
  border-radius: 0 22px 22px 0;
  background: linear-gradient(160deg, #60a5fa, #1d4ed8 60%);
}

.half:hover {
  transform: scale(1.015);
}

.title {
  font-size: clamp(1.2rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-word {
  display: none;
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.result-word.win {
  color: #dcfce7;
}

.result-word.lose {
  color: #ffe4d6;
}

.count {
  display: none;
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 900;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.lock {
  display: none;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: rgba(255, 255, 255, 0.14);
}

.timer {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  min-width: 70px;
  z-index: 3;
  text-align: center;
  font-size: clamp(1.2rem, 3.8vw, 2rem);
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.center-panel {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(74%, 300px);
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.phase {
  margin: 0;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0.92;
}

.hint {
  margin: 0;
  font-size: clamp(0.95rem, 2.3vw, 1.1rem);
  font-weight: 600;
}

.outcome {
  margin: 0;
  font-weight: 800;
  min-height: 1.3rem;
}

.arena:not(.result) .hint,
.arena:not(.result) .outcome {
  display: none;
}

.arena.result .count {
  display: block;
}

.arena.result .result-word {
  display: block;
}

.arena.locked .lock {
  display: inline-block;
}

.arena.locked .half.dimmed {
  filter: grayscale(0.22);
  opacity: 0.62;
}

.arena.locked .half.selected {
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.74);
  opacity: 1;
}

.arena.result .half {
  cursor: default;
}

.outcome.win {
  color: var(--ok);
}

.outcome.lose {
  color: var(--bad);
}

@media (max-width: 560px) {
  .center-panel {
    bottom: 10px;
  }

  .timer {
    top: 10px;
  }
}
