.circle-page {
  --ink: #f5f0e7;
  --accent: #e5cfa0;
  --edge: #bbc7b844;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #101411;
  color: var(--ink);
}

.circle-page::before {
  background:
    repeating-linear-gradient(115deg, #ffffff03 0 1px, transparent 1px 6px),
    radial-gradient(ellipse at 50% 45%, #282932 0%, #17171d 42%, #0d0d11 85%);
}

.circle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .85rem;
  padding: .65rem clamp(.85rem, 3vw, 2.5rem);
}

.circle-header .wordmark span { color: var(--accent); }
.circle-test, .circle-workspace {
  position: relative;
  display: grid;
  min-height: 0;
}
.circle-workspace { grid-template-rows: minmax(19rem, 1fr) .2rem auto; }
.circle-intro {
  position: absolute;
  z-index: 1;
  inset: clamp(.25rem, 2.5vh, 1.5rem) 1rem auto;
  text-align: center;
  pointer-events: none;
  transition: opacity .18s ease;
}
.circle-test:has(.has-stroke) .circle-intro { opacity: 0; }
.circle-page:has(.has-stroke) .circle-header .wordmark,
.circle-page:has(.has-stroke) .back-link { opacity: .5; }
.circle-intro h1 {
  padding: 0;
  color: var(--ink);
  font: 550 clamp(1.5rem, 4.3vw, 3rem)/1.03 Georgia, serif;
  letter-spacing: -.035em;
}
.circle-intro h1 span { color: var(--accent); }
.circle-intro p {
  margin: .4rem 0 0;
  color: #e0e7dd;
  font-size: .9rem;
}

.drawing-board { min-height: 0; position: relative; }
#drawing {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.canvas-center, .canvas-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}
.center-dot {
  position: absolute;
  width: .52rem;
  height: .52rem;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #f8f4ea;
  box-shadow: 0 0 1rem #f8f4ea70;
}
#center-progress {
  --trail-color: #95ffce;
  --turn: 0deg;
  position: absolute;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: conic-gradient(var(--trail-color) var(--turn), #e5f2df26 0);
  mask-image: radial-gradient(circle, transparent 57%, #000 60%);
  opacity: 0;
  transition: opacity .16s ease;
}
.drawing-board[data-state="drawing"] #center-progress { opacity: 1; }
.drawing-board[data-state="scored"] #live-score,
.drawing-board[data-state="qualified"] #live-score {
  animation: score-settle .38s cubic-bezier(.16, 1, .3, 1) both;
}
.drawing-board[data-state="qualified"] .center-dot {
  animation: center-celebrate .65s ease-out both;
}
@keyframes score-settle {
  from { transform: translateX(-50%) scale(.88); opacity: .68; }
  60% { transform: translateX(-50%) scale(1.06); }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes center-celebrate {
  from { box-shadow: 0 0 0 0 #a9e5b799; }
  to { box-shadow: 0 0 0 2rem #a9e5b700; }
}
.canvas-hint {
  width: max-content;
  margin: 1rem 0 0;
  color: #c5d1c3;
  font-size: .88rem;
}
.has-stroke .canvas-hint { visibility: hidden; }

#live-score, #best-score {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
#live-score {
  bottom: .25rem;
  color: #f5de9b;
  font: 850 clamp(2.4rem, 8vw, 6.4rem)/.9 system-ui, sans-serif;
  letter-spacing: -.065em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 18px #101411;
}
#best-score {
  top: 1.05rem;
  color: #e4dac0;
  font: 650 clamp(.82rem, 2vw, 1.05rem)/1.2 system-ui, sans-serif;
}
.stroke-meter {
  height: .2rem;
  overflow: hidden;
  background: #bbc7b818;
}
#stroke-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #6bdbbb, #ead6a0);
  transition: transform .1s ease-out;
}
.drawing-board[data-state="corner"] + .stroke-meter #stroke-fill { background: #ee8b8e; }

.circle-result {
  min-height: 7.4rem;
  display: grid;
  place-items: center;
  padding: .65rem clamp(1rem, 4vw, 4rem);
  text-align: center;
}
#score { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#verdict { margin: 0; color: #edf0e6; line-height: 1.4; }
.drawing-board:not(.has-stroke) ~ .circle-result { visibility: hidden; }
.circle-result[data-result]:not([data-result=""]) #verdict {
  padding: .4rem .9rem;
  border: 1px solid #a4a3c445;
  border-radius: 1rem;
  background: #131219;
}
.circle-result[data-result="pass"] #verdict { color: #adf0c9; }
.result-actions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
  margin-top: .55rem;
}
.result-actions button {
  border: 1px solid #a9efcb60;
  border-radius: 2rem;
  padding: .45rem .8rem;
  min-height: 44px;
  font: 650 .85rem system-ui, sans-serif;
  color: #e5ffee;
  background: #254339;
  cursor: pointer;
}
.result-actions button:hover { background: #355c4d; }
.result-actions button:disabled { opacity: .55; cursor: default; }

.back-link {
  justify-self: center;
  padding: .2rem .7rem .85rem;
  color: #c7d0c3;
  font-size: .83rem;
}
.back-link:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  #stroke-fill, .circle-intro, #center-progress { transition: none; }
  .drawing-board #live-score, .drawing-board .center-dot { animation: none !important; }
}
