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

:root {
  --bg-dark: #171210;
  --bg-card: #241c15;
  --gold: #d4a94e;
  --gold-bright: #f0c96a;
  --ink: #f0e6d2;
  --ink-dim: #a89a80;
  --green: #3d8b40;
  --red: #b23b3b;
  --radius: 14px;
}

html {
  background: radial-gradient(ellipse at 50% -20%, #2e2318 0%, var(--bg-dark) 60%) fixed;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

.site-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: var(--gold-bright);
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.subtitle {
  color: var(--ink-dim);
  font-style: italic;
}

/* ---- screens ---- */

.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ---- generic bits ---- */

.card {
  background: var(--bg-card);
  border: 1px solid #3d3225;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.center {
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
}

.center h2 {
  color: var(--gold);
  margin-bottom: 18px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px;
  font-size: 1.15rem;
  font-family: inherit;
  background: #171210;
  color: var(--ink);
  border: 2px solid #4a3d2a;
  border-radius: 10px;
  margin-bottom: 16px;
  text-align: center;
}

input:focus {
  outline: none;
  border-color: var(--gold);
}

.btn {
  font-family: inherit;
  font-size: 1.05rem;
  padding: 12px 26px;
  border-radius: 10px;
  border: 2px solid #4a3d2a;
  background: #2c2318;
  color: var(--ink);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--gold);
}

.btn.gold {
  background: linear-gradient(180deg, var(--gold-bright), #b8860b);
  border-color: #8a6914;
  color: #241a08;
  font-weight: bold;
}

.btn.gold:hover {
  filter: brightness(1.1);
}

.btn.danger {
  border-color: #6e2f2f;
  color: #e08a8a;
}

.btn.danger:hover {
  border-color: var(--red);
}

.link {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}

.hint {
  color: var(--ink-dim);
  text-align: center;
  margin-bottom: 20px;
}

.playing-as {
  text-align: center;
  margin-bottom: 6px;
  color: var(--ink-dim);
}

.playing-as strong {
  color: var(--gold-bright);
}

.error {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #5c1f1f;
  border: 1px solid var(--red);
  color: #ffd9d9;
  padding: 12px 22px;
  border-radius: 10px;
  max-width: 90vw;
  z-index: 10;
}

.hidden {
  display: none !important;
}

/* ---- the circle board ---- */

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 22px;
  justify-items: center;
  margin-top: 10px;
}

.circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px;
  text-align: center;
  font-family: inherit;
  position: relative;
}

.circle .num {
  font-size: 1.7rem;
  font-weight: bold;
  line-height: 1.1;
}

.circle .circle-title {
  font-size: 0.78rem;
  line-height: 1.25;
  max-width: 110px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.circle.filled {
  cursor: pointer;
  color: var(--ink);
  background: radial-gradient(circle at 35% 30%, #3a2d1c, #241c12);
  border: 3px solid var(--gold);
  box-shadow: 0 0 14px rgba(212, 169, 78, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.circle.filled:hover {
  transform: scale(1.06);
  box-shadow: 0 0 22px rgba(240, 201, 106, 0.5);
}

.circle.filled .num {
  color: var(--gold-bright);
}

.circle.locked,
.circle.empty {
  background: #1d1a16;
  border: 3px dashed #4d463c;
  color: #6b6355;
}

.circle.locked {
  cursor: not-allowed;
  opacity: 0.65;
}

.circle.empty {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.circle.empty:hover {
  transform: scale(1.06);
  border-color: var(--gold);
  color: var(--ink-dim);
}

.circle .badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #eaffea;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.board-actions {
  text-align: center;
  margin-top: 30px;
}

/* ---- quiz play ---- */

.quiz-title {
  text-align: center;
  color: var(--gold);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.progress {
  text-align: center;
  color: var(--ink-dim);
  margin-bottom: 14px;
  font-style: italic;
}

.question {
  text-align: center;
  font-size: clamp(1.7rem, 4.5vw, 2.8rem);
  color: var(--gold-bright);
  margin: 8px auto 34px;
  max-width: 850px;
  line-height: 1.3;
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .answers {
    grid-template-columns: 1fr 1fr;
  }
}

.answer {
  font-family: inherit;
  font-size: 1.3rem;
  padding: 22px 18px;
  border-radius: var(--radius);
  border: 2px solid #4a3d2a;
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.answer:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.answer:disabled {
  cursor: default;
  opacity: 0.85;
}

.answer.correct {
  background: var(--green);
  border-color: #67c26b;
  color: #f2fff2;
  opacity: 1;
}

.answer.wrong {
  background: var(--red);
  border-color: #e07a7a;
  color: #fff0f0;
  opacity: 1;
}

/* ---- admin editor ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar h2 {
  color: var(--gold);
  margin-right: auto;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 820px) {
  .editor-layout {
    grid-template-columns: 3fr 2fr;
    align-items: start;
  }
}

textarea {
  width: 100%;
  min-height: 420px;
  padding: 16px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  background: #14100d;
  color: var(--ink);
  border: 2px solid #4a3d2a;
  border-radius: var(--radius);
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.help h3 {
  color: var(--gold);
  margin-bottom: 10px;
}

.help pre {
  background: #14100d;
  border: 1px solid #3d3225;
  border-radius: 10px;
  padding: 14px;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 10px 0;
  color: #d8cdb4;
}

.help p {
  font-size: 0.92rem;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.errors {
  background: #421c1c;
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
}

.errors li {
  margin-left: 18px;
  color: #ffd9d9;
}

.notice {
  background: #1e3320;
  border: 1px solid var(--green);
  border-radius: 10px;
  padding: 12px 18px;
  margin: 14px 0;
  color: #d2f5d2;
}

/* ---- results table ---- */

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #3d3225;
}

th {
  color: var(--gold);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

tr:first-child td {
  color: var(--gold-bright);
  font-weight: bold;
}

tr.me td {
  background: rgba(212, 169, 78, 0.14);
}
