/* Körlemesine — görsel kimlik.
 *
 * Yön: karanlık bir oda ve bir kara tahta. Çizim fazında tahta gerçekten boş —
 * yüzey düz siyah, üzerinde hiçbir iz yok. Bu dekor değil, oyunun kuralının
 * görselleşmiş hâli: göremediğin şeyi çiziyorsun. Süre bitince çizgiler tebeşirle
 * yazılıyormuş gibi soldan sağa beliriyor; asıl komik an o.
 *
 * Tailwind CDN yerleşim yardımcıları için kullanılıyor; kimlik burada tanımlı ki
 * CDN yavaş gelse bile sayfa doğru görünsün.
 */

/* Renkler WCAG AA'ya göre seçildi, göze göre değil. Ölçülen oranlar (zemin --room
   üstünde, sonra --surface üstünde):
     --chalk    15.94:1 / 14.29:1
     --amber     8.55:1 /  7.67:1
     --muted     7.18:1 /  6.43:1
     --ok        9.58:1
     --no        6.32:1
     --edge      3.14:1 (UI sınırı için ≥3 şart — ilk denediğim #39424D 1.80:1'di)
   Amber üstündeki koyu metin: 8.55:1. */
:root {
  --room: #11151a; /* oda */
  --surface: #1a2027; /* yükseltilmiş yüzey */
  --void: #07090b; /* kör tuval — hiçbir şeyin görünmediği yer */
  --board: #131a18; /* açılmış tuval; hafif yeşile çalar, kara tahta */
  --chalk: #f2efe6; /* tebeşir */
  --amber: #f0a03c; /* sıra sende / süre */
  --muted: #9aa3ae; /* yardımcı metin */
  --edge: #5a6675; /* kenarlık */
  --ok: #6fcf8b;
  --no: #f2705a;

  --radius: 14px;
  --pad: clamp(16px, 4.5vw, 24px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--room);
  color: var(--chalk);
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  /* Çizerken sayfanın kaymasını istemiyoruz; tuval ayrıca touch-action: none. */
  overscroll-behavior: none;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + var(--pad)) var(--pad)
    calc(var(--safe-bottom) + var(--pad));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- tipografi ------------------------------------------------------------ */

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.title {
  font-size: clamp(28px, 9vw, 40px);
  line-height: 1.05;
}

.label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.muted--error {
  color: var(--no);
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* --- yüzeyler ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

/* --- üst şerit ------------------------------------------------------------ */

/* `[hidden]` yalnızca UA stil sayfasında `display: none` — aşağıdaki `display: flex`
   ona üstün gelir ve gizlenmesi gereken şeritler ekranda kalır. Bu dosyadaki her
   `display` kuralı için geçerli, o yüzden kural burada bir kez yazılı. */
[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--edge);
}

.topbar__phase {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

.dot--off {
  background: var(--no);
}

/* --- kelime kartı --------------------------------------------------------- */

.prompt {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.prompt__word {
  font-size: clamp(26px, 8.5vw, 38px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.prompt--slim {
  padding: 12px 16px;
}

.prompt--slim .prompt__word {
  font-size: clamp(17px, 5vw, 22px);
}

/* --- geri sayım ----------------------------------------------------------- */

.ring {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
  flex: none;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring__track {
  fill: none;
  stroke: var(--edge);
  stroke-width: 6;
}

.ring__value {
  fill: none;
  stroke: var(--amber);
  stroke-width: 6;
  stroke-linecap: round;
}

.ring__count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ring--small {
  width: 84px;
  height: 84px;
}

.ring--small .ring__count {
  font-size: 26px;
}

/* Dokunuş kaydedildiğinde halka nabız atar. Konum bilgisi TAŞIMAZ — kör kalmak
   oyunun kuralı, geri bildirim sadece "parmağın algılandı" der. */
.ring--pulse .ring__value {
  animation: pulse 240ms ease-out;
}

@keyframes pulse {
  50% {
    stroke-width: 10;
  }
}

/* --- tuval ---------------------------------------------------------------- */

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--edge);
  background: var(--board);
}

.canvas-wrap--blind {
  background: var(--void);
  border-color: #2a323c;
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Çizerken sayfa kaymasın, tarayıcı jesti devralmasın. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.canvas-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: #4b555f; /* void üstünde 3.02:1 — kasten sönük, okunur */
  font-size: 13px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.canvas-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 21, 26, 0.82);
  border: 1px solid var(--edge);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- düğmeler ------------------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--chalk);
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 14px 18px;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--room);
}

.btn--ok {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--room);
}

.btn--no {
  background: var(--no);
  border-color: var(--no);
  color: var(--room);
}

.btn--ghost {
  color: var(--muted);
}

.btn--wide {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.btn-group .btn {
  flex: 1 1 0;
}

/* --- girdiler ------------------------------------------------------------- */

.input {
  appearance: none;
  width: 100%;
  background: var(--room);
  border: 1px solid var(--edge);
  border-radius: 10px;
  color: var(--chalk);
  font: inherit;
  padding: 14px 16px;
  min-height: 48px;
}

.input::placeholder {
  color: #8b94a0; /* room üstünde 6.09:1 */
}

.input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
  border-color: var(--amber);
}

.input--code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 22px;
  letter-spacing: 0.34em;
  text-align: center;
  text-transform: uppercase;
}

/* --- lobi ----------------------------------------------------------------- */

.code-big {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: clamp(40px, 15vw, 64px);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  /* letter-spacing sağdan boşluk bırakır, ortalamayı bozar */
  text-indent: 0.18em;
}

.qr {
  width: min(200px, 58vw);
  aspect-ratio: 1;
  margin: 0 auto;
  display: block;
  border-radius: 10px;
  background: #f2efe6;
  padding: 8px;
}

/* Çizim süresi: iki sayı alanı, dakika ve saniye. */
.time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input--time {
  width: 5rem;
  flex: none;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 20px;
  text-align: center;
  padding: 12px 4px;
}

/* Sayı alanlarının artırma okları dar kutuda değeri kırpıyor. */
.input--time::-webkit-outer-spin-button,
.input--time::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input--time {
  -moz-appearance: textfield;
  appearance: textfield;
}

.time-unit {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- sonuç ---------------------------------------------------------------- */

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

.verdict--ok {
  color: var(--ok);
}

.verdict--no {
  color: var(--no);
}

.guess-line {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.guess-line strong {
  font-weight: 600;
}

/* --- bildirim ------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
  z-index: 40;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toast-in 180ms ease-out;
}

.toast--error {
  border-color: var(--no);
  color: var(--no);
}

.toast--leaving {
  animation: toast-out 200ms ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* --- erişilebilirlik ------------------------------------------------------ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
