* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  --bg: #050714;
  --panel: rgba(12, 16, 40, 0.82);
  --panel-border: rgba(255, 255, 255, 0.15);
  --panel-glow: rgba(95, 125, 255, 0.4);
  --accent: #7ef9ff;
  --accent-strong: #ffdd65;
  --muted: #e3eaff;
  --muted-soft: rgba(227, 234, 255, 0.72);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #3720ff 0%, #0a0c25 50%);
  color: var(--muted);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(1rem, 2vw, 3rem);
  position: relative;
  overflow: hidden;
}

body::before,
body::after {
  content: '';
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 60%);
  z-index: 0;
}

body::before {
  top: -20vmax;
  left: -10vmax;
  animation: drift 22s linear infinite;
}

body::after {
  bottom: -25vmax;
  right: -5vmax;
  animation: drift 28s linear infinite reverse;
}

@keyframes drift {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 1rem;
  background: var(--accent);
  color: #041024;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  z-index: 2;
  opacity: 0;
}

.skip-link:focus {
  opacity: 1;
}

.caller {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  background: var(--panel);
  border-radius: 32px;
  padding: clamp(1.5rem, 3vw, 3rem);
  box-shadow: 0 25px 60px rgba(3, 6, 18, 0.9);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
}

.caller__hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
}

.caller__hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, 4vw, 4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.caller__settings {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: right;
}

.caller__settings label {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.caller__settings input {
  width: 120px;
  padding: 0.65rem 0.85rem;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 1.15rem;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.caller__settings input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}

.caller__stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.neon-panel {
  border-radius: 26px;
  padding: 1.5rem;
  border: 1px solid var(--panel-border);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.35));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5), 0 0 30px var(--panel-glow);
  min-width: 0;
  overflow: hidden;
}

.caller__ball {
  text-align: center;
}

.ball {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #fff, #ffb300 60%);
  box-shadow: inset -6px -6px 22px rgba(255, 255, 255, 0.7), inset 6px 6px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.8rem;
  font-weight: 700;
  color: #3e1c00;
  text-shadow: 0 0 9px rgba(255, 255, 255, 0.7);
}

.ball.pop {
  animation: pop 0.65s ease-out;
}

.ball.shake {
  animation: shake 0.45s ease-in-out infinite;
}

@keyframes pop {
  0% {
    transform: scale(0.8);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0% {
    transform: translateX(-2px) rotate(-2deg);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
  }
  50% {
    transform: translateX(2px) rotate(2deg);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
  }
  100% {
    transform: translateX(-1px) rotate(-1deg);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
  }
}

.caller__remark {
  margin-top: 0.6rem;
  font-size: 1.2rem;
  color: var(--accent);
}

.caller__controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.5rem 0;
}

.caller__controls button {
  flex: 1 1 150px;
  border: none;
  padding: 0.9rem 1.1rem;
  border-radius: 999px;
  background: linear-gradient(120deg, #5afff7, #c56bff);
  color: #04071a;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 26px rgba(7, 20, 45, 0.6);
}

.caller__controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(7, 20, 45, 0.7);
}

.caller__controls button:active {
  transform: translateY(0px);
}

.caller__stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: center;
  height: 100%;
}

.caller__stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.caller__stats > div:last-child {
  border-bottom: none;
}

.caller__stats span {
  display: block;
  font-size: clamp(2.4rem, 3.2vw, 3.5rem);
  font-weight: 700;
  color: var(--accent-strong);
}

.caller__stat-label {
  display: block;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent-strong);
  margin-bottom: 0.5rem;
  font-weight: 600;
  opacity: 0.9;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-title h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.9;
}

.panel-title small {
  color: var(--muted-soft);
  letter-spacing: 0.2em;
  font-size: 0.85rem;
}

.caller__board {
  position: relative;
  min-height: 280px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.board-row {
  display: contents;
}

.board-cell {
  padding: 0.7rem 0.4rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 6px 14px rgba(255, 255, 255, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.board-cell.called {
  background: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.98), #ffd966);
  color: #201200;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 24px rgba(255, 221, 101, 0.4), inset 0 0 12px rgba(255, 255, 255, 0.7);
  transform: translateY(-2px) scale(1.04);
}

.caller__log {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

#call-log {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#call-log li {
  padding: 0.6rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  transition: background 0.2s ease;
}

#call-log li:hover {
  background: rgba(255, 255, 255, 0.1);
}

#call-log li strong {
  font-size: 1.05rem;
  color: var(--accent-strong);
}

@media (max-width: 720px) {
  .caller__hero {
    flex-direction: column;
    align-items: stretch;
  }

  .caller__settings {
    text-align: left;
  }

  .board-grid {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  }
}

@media (max-width: 560px) {
  .caller__controls button {
    flex: 1 1 100%;
  }
}
