/* ---------- Oyun Ekranı ---------- */
.game-screen {
  padding: 8px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Topbar */
.topbar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 8px 0 4px;
}

.topbar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--ink);
  color: var(--card-bg);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.icon-btn:hover {
  background: var(--line-2);
}

/* Meta satırı */
.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  flex-wrap: wrap;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.difficulty {
  margin-left: auto;
  margin-right: auto;
  background: var(--line-2);
  color: var(--ink);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.difficulty strong {
  font-weight: 700;
}

.reset-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--btn-border);
  color: var(--btn-ink);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
}

.reset-btn:disabled { opacity: 0.4; }

/* Izgara */
.grid-wrap {
  background: var(--card-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
}

.grid {
  position: relative;
  display: grid;
  width: 100%;
  user-select: none;
  touch-action: none;
}

.grid-cell {
  border-right: 1px var(--grid-line) var(--line);
  border-bottom: 1px var(--grid-line) var(--line);
}

.region {
  border: 2px solid currentColor;
  border-radius: 6px;
  pointer-events: none;
  margin: 2px;
  z-index: 1;
}

.region.drag-preview {
  border-style: dashed;
  z-index: 2;
}

.region.hint-preview {
  border-style: dashed;
  opacity: 0.9;
  z-index: 2;
  animation: hintPulse 0.9s ease-in-out infinite;
}

.region-ref-anchor {
  pointer-events: none;
  z-index: 4;
  align-self: center;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.region-ref-number {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid var(--seed-fill);
  border-radius: 7px;
  background: var(--card-bg);
  color: var(--seed-fill);
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.seed {
  --seed-fill: var(--ink);
  color: white;
  font-family: 'SF Pro Rounded', 'SF Pro Display', var(--font), system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 2.7vw, 72px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  z-index: 3;
  cursor: grab;
  width: 58%;
  height: 58%;
  border: none;
  background: transparent;
  box-shadow: none;
  position: relative;
  touch-action: none;
  overflow: visible;
}

.seed-core {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12%;
  background: var(--seed-fill);
  border: 0.2px dashed var(--seed-fill);
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.seed-number {
  position: relative;
  z-index: 3;
  min-width: 10px;
  height: 1em;
  color: #fff;
  font: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seed-shape-square {
  width: 58%;
  height: 58%;
}

.seed-shape-wide {
  width: 76%;
  height: 54%;
}

.seed-shape-wide .seed-core {
  border-radius: 28% / 38%;
}

.seed-shape-tall {
  width: 54%;
  height: 76%;
}

.seed-shape-tall .seed-core {
  border-radius: 38% / 28%;
}

.seed-shape-any {
  width: 76%;
  height: 76%;
}

.seed-shape-any .seed-core {
  width: 76.47%;
  height: 76.47%;
  border-radius: 11.54%;
}

.seed-shape-any::before,
.seed-shape-any::after {
  content: '';
  position: absolute;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--seed-fill) 36%, transparent);
  border: 0.2px dashed var(--seed-fill);
  border-radius: 23.53%;
  z-index: 1;
  pointer-events: none;
}

.seed-shape-any::before {
  width: 100%;
  height: 76.47%;
  left: 0;
  top: 11.76%;
}

.seed-shape-any::after {
  width: 76.47%;
  height: 100%;
  left: 11.76%;
  top: 0;
}

.seed-placed.seed-shape-square {
  width: 58%;
  height: 58%;
}

.seed-placed.seed-shape-any {
  width: 76%;
  height: 76%;
}

.seed-placed.seed-shape-wide {
  width: 76%;
  height: 54%;
}

.seed-placed.seed-shape-tall {
  width: 54%;
  height: 76%;
}

.seed-hint { animation: hintPulse 0.6s ease-in-out infinite; }

@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.seed:active { cursor: grabbing; }

/* Hata toast'ı */
.error-toast {
  position: fixed;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 80%;
}

.error-toast button {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1;
}

/* Kontroller */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ctrl-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-ink);
  padding: 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s;
}

.ctrl-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Talimatlar */
.instructions {
  background: var(--card-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
}

.instructions-title {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
  font-family: var(--font);
}

.instructions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.legend-icon {
  display: inline-block;
  background: var(--line);
  border: 1px solid var(--ink-2);
  flex: 0 0 auto;
}

.legend-square { width: 18px; height: 18px; border-radius: 3px; }
.legend-tall   { width: 14px; height: 22px; border-radius: 3px; }
.legend-wide   { width: 22px; height: 14px; border-radius: 3px; }

.legend-any {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1.5px dashed var(--ink-2);
  background: rgba(0, 0, 0, 0.06);
}

.instructions-foot {
  text-align: center;
  font-size: 12px;
  color: var(--ink-2);
  border-top: 1px solid var(--line-2);
  padding-top: 10px;
}

/* Sonuç butonu */
.results-btn {
  background: var(--ink);
  color: var(--card-bg);
  border: none;
  padding: 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  margin-top: 8px;
}

.celebration-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}

.celebration-bit {
  position: absolute;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  background: #22c55e;
  opacity: 0;
  animation: celebrationPop 1.35s cubic-bezier(.16, .84, .28, 1) forwards;
  animation-delay: var(--burst-delay);
}

.celebration-bit:nth-child(4n + 1) { background: #ef4444; }
.celebration-bit:nth-child(4n + 2) { background: #d4a017; }
.celebration-bit:nth-child(4n + 3) { background: #0ea5e9; }
.celebration-bit:nth-child(4n + 4) { background: #8b5cf6; }

@keyframes celebrationPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y) + 120px))
      scale(1)
      rotate(var(--burst-rotate));
  }
}

.result-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.result-modal-card {
  width: min(420px, 100%);
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  animation: resultCardIn 0.22s ease-out;
}

.result-modal-kicker {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-modal-card h2 {
  margin: 6px 0 18px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.result-modal-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.result-modal-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}

.result-modal-stats span {
  color: var(--ink-2);
  font-size: 13px;
}

.result-modal-stats strong {
  font-size: 16px;
  text-align: right;
}

.result-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-secondary-btn,
.result-primary-btn {
  border-radius: 999px;
  padding: 13px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.result-secondary-btn {
  background: transparent;
  color: var(--btn-ink);
  border: 1px solid var(--btn-border);
}

.result-primary-btn {
  background: var(--ink);
  color: var(--card-bg);
  border: 1px solid var(--ink);
}

@keyframes resultCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
