/* Yazı Ustası — yalnızca .birles-yazu. Overlay / Ses Evreni kabuğuna dokunma. */
.birles-body:has(> .birles-yazu) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.birles-yazu {
  --yu-ink: #1a2a3a;
  --yu-gold: #c9a227;
  --yu-paper: #fff8ec;
  --yu-teal: #1a6b68;
  --chip: var(--yu-teal);
  --ink: var(--yu-ink);
  --paper: var(--yu-paper);
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: min(100%, 720px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 14px);
  padding: 2px 0 8px;
  font-family: "ComfortaaOkul", "Comfortaa", "Baloo 2", sans-serif;
}

.birles-yazu__ambient {
  pointer-events: none;
  position: absolute;
  inset: -12px -8px auto;
  height: min(42vh, 280px);
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 90% at 12% 0%, rgba(201, 162, 39, 0.22), transparent 58%),
    radial-gradient(ellipse 70% 80% at 92% 8%, rgba(26, 107, 104, 0.18), transparent 52%),
    radial-gradient(ellipse 50% 50% at 50% 100%, rgba(180, 35, 24, 0.06), transparent 62%);
}

.birles-yazu__hero {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  text-align: left;
  padding: clamp(10px, 1.8vh, 16px) clamp(12px, 2.4vw, 18px);
  border-radius: clamp(18px, 3.2vw, 26px);
  background:
    linear-gradient(165deg, rgba(255, 252, 244, 0.94), rgba(247, 236, 214, 0.88)),
    repeating-linear-gradient(90deg, transparent, transparent 11px, rgba(201, 162, 39, 0.06) 11px, rgba(201, 162, 39, 0.06) 12px);
  border: 1px solid rgba(201, 162, 39, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 12px 28px rgba(58, 42, 18, 0.1);
}

.birles-yazu__seal {
  grid-row: 1 / span 3;
  width: clamp(52px, 12vw, 72px);
  height: clamp(52px, 12vw, 72px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff8ec;
  font-family: "TemelYazi", "ComfortaaOkul", "Comfortaa", sans-serif;
  font-size: clamp(1.55rem, 6vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.28), transparent 42%),
    radial-gradient(circle at 50% 50%, #c43c32, #7a1610 72%);
  box-shadow:
    0 0 0 3px rgba(201, 162, 39, 0.45),
    0 8px 18px rgba(122, 22, 16, 0.28);
}

.birles-yazu__badge {
  grid-column: 2;
  justify-self: start;
  display: inline-flex;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b4e12;
  background: rgba(201, 162, 39, 0.16);
  border: 1px solid rgba(201, 162, 39, 0.32);
}

.birles-yazu__word-big {
  grid-column: 2;
  margin: 0;
  font-family: "TemelYazi", "ComfortaaOkul", "Comfortaa", sans-serif;
  font-size: clamp(1.7rem, 7.2vw, 2.7rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--yu-ink);
  line-height: 1.05;
}

.birles-yazu__progress-row {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  min-width: 0;
}

.birles-yazu__progress {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--yu-teal);
  white-space: nowrap;
}

.birles-yazu__meter {
  flex: 1;
  min-width: 48px;
  height: 7px;
  border-radius: 999px;
  background: rgba(26, 107, 104, 0.14);
  overflow: hidden;
}

.birles-yazu__meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a6b68, #c9a227);
  width: 0;
  transition: width 0.35s ease;
}

.birles-yazu__dots {
  display: none;
}

.birles-yazu__words {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.birles-yazu__words::-webkit-scrollbar {
  display: none;
}

.birles-yazu__word {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 72px;
  min-height: 42px;
  padding: 0 14px;
  border: 1.5px solid rgba(26, 42, 58, 0.14);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.92);
  color: var(--yu-ink);
  font-family: "TemelYazi", "ComfortaaOkul", "Comfortaa", sans-serif;
  font-size: clamp(1.02rem, 3.6vw, 1.22rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(58, 42, 18, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.birles-yazu__word:hover {
  transform: translateY(-1px);
}

.birles-yazu__word.is-on {
  background: linear-gradient(165deg, #f0d57a, #c9a227);
  border-color: #8a6a12;
  color: #2a1c04;
  box-shadow:
    0 6px 0 #8a6a12,
    0 10px 18px rgba(201, 162, 39, 0.32);
}

.birles-yazu__word.is-done:not(.is-on) {
  border-color: rgba(21, 128, 61, 0.4);
  color: #166534;
  background: #f3fbf4;
}

.birles-yazu__word-check {
  font-size: 0.8rem;
  color: #16a34a;
}

.birles-yazu__meta {
  display: none;
}

.birles-yazu__desk {
  position: relative;
  flex: 1 1 0;
  min-height: 140px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(8px, 1.6vh, 14px);
  border-radius: clamp(20px, 3.4vw, 30px);
  background:
    linear-gradient(180deg, rgba(62, 44, 22, 0.08), rgba(62, 44, 22, 0.14)),
    repeating-linear-gradient(
      90deg,
      #6b4a2a 0 10px,
      #7a5633 10px 12px,
      #614226 12px 22px
    );
  box-shadow:
    0 1px 0 rgba(255, 236, 200, 0.25) inset,
    0 16px 36px rgba(40, 24, 8, 0.18);
}

.birles-yazu__stage-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(8px, 1.4vh, 14px);
  border-radius: clamp(16px, 2.6vw, 24px);
  background: linear-gradient(180deg, #fffdf7, #f6ead4);
  border: 1px solid rgba(234, 217, 184, 0.95);
  box-shadow:
    0 1px 0 #fff inset,
    0 10px 24px rgba(40, 24, 8, 0.16);
  display: flex;
  min-height: 0;
}

.birles-yazu__stage {
  position: relative;
  width: 100%;
  min-height: 0;
  flex: 1;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
}

.birles-yazu__svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

.birles-yazu__paper {
  fill: #fff8ec;
  stroke: rgba(201, 162, 39, 0.28);
  stroke-width: 1.5;
  filter: drop-shadow(0 6px 14px rgba(58, 42, 18, 0.08));
}

.birles-yazu__paper-edge {
  fill: rgba(180, 35, 24, 0.12);
  stroke: none;
}

.birles-yazu__guide {
  stroke: rgba(58, 110, 180, 0.32);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.birles-yazu__guide--mid {
  stroke-dasharray: 6 5;
  stroke: rgba(201, 162, 39, 0.55);
  stroke-width: 1.85;
}

.birles-yazu__ghost {
  stroke: rgba(26, 42, 58, 0.18);
  stroke-width: 17;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.birles-yazu__stroke {
  stroke: #1a6b68;
  stroke-width: 17;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.96;
}

.birles-yazu__stroke.is-live {
  stroke: #c9a227;
}

.birles-yazu__stroke.is-done {
  stroke: #15803d;
}

.birles-yazu__stroke.is-fail {
  stroke: #dc2626;
}

.birles-yazu__user {
  stroke: rgba(201, 162, 39, 0.7);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.birles-yazu__pen {
  fill: #c9a227;
  stroke: #fff;
  stroke-width: 2.5;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(201, 162, 39, 0.45));
}

.birles-yazu__hit {
  position: absolute;
  inset: 0;
  z-index: 4;
  touch-action: none;
  cursor: crosshair;
}

.birles-yazu__tip {
  flex: 0 0 auto;
  margin: 0;
  min-height: 1.15em;
  text-align: center;
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  font-weight: 700;
  color: var(--yu-teal);
}

.birles-yazu__actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 12px);
  max-width: none;
  margin: 0;
  width: 100%;
}

.birles-yazu-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: clamp(68px, 12vh, 88px);
  padding: 8px 6px 10px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-family: "ComfortaaOkul", "Comfortaa", "Baloo 2", sans-serif;
  color: #143447;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.birles-yazu-act__ico {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
  color: inherit;
}

.birles-yazu-act__txt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.15;
}

.birles-yazu-act strong {
  font-size: clamp(0.78rem, 2.6vw, 0.92rem);
  font-weight: 800;
}

.birles-yazu-act small {
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.72;
}

.birles-yazu-act--write {
  color: #0f3d32;
  background: linear-gradient(165deg, #9dffc4 0%, #3dd68c 50%, #1fad6a 100%);
  box-shadow: 0 6px 0 #158a52, 0 10px 18px rgba(31, 173, 106, 0.26);
}

.birles-yazu-act--listen {
  color: #fff;
  background: linear-gradient(165deg, #5fd0ff 0%, #2a9df4 45%, #1b6fd4 100%);
  box-shadow: 0 6px 0 #1558a8, 0 10px 18px rgba(42, 157, 244, 0.26);
}

.birles-yazu-act--listen .birles-yazu-act__ico {
  color: #1b6fd4;
}

.birles-yazu-act--write .birles-yazu-act__ico {
  color: #158a52;
}

.birles-yazu-act--back {
  color: #4a3418;
  background: linear-gradient(165deg, #ffe29a 0%, #ffc14a 55%, #f0a202 100%);
  box-shadow: 0 6px 0 #c47d00, 0 10px 18px rgba(240, 162, 2, 0.24);
}

.birles-yazu-act--back .birles-yazu-act__ico {
  color: #b36b00;
}

.birles-yazu-act:hover,
.birles-yazu-act:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.birles-yazu-act:active {
  transform: translateY(3px);
}

.birles-yazu-act.is-on {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.birles-yazu__wide-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 56px;
  padding: 10px 14px;
  border: 1.5px dashed rgba(201, 162, 39, 0.5);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255, 248, 230, 0.96), rgba(255, 255, 255, 0.9));
  color: var(--yu-ink);
  cursor: pointer;
  font-family: "ComfortaaOkul", "Comfortaa", "Baloo 2", sans-serif;
  box-shadow: 0 6px 16px rgba(58, 42, 18, 0.08);
}

.birles-yazu__wide-btn small {
  opacity: 0.7;
  font-size: 0.7rem;
  font-weight: 700;
}

.birles-yazu__wide-btn-ico {
  color: var(--yu-gold);
}

.birles-yazu__status {
  flex: 0 0 auto;
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 14px;
}

.birles-yazu__status.is-ok {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.birles-yazu__status.is-bad {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

/* Yatay tam ekran — overlay dışında da (body’ye taşınınca) viewport’u kaplar */
.birles-yazu__sheet,
body > .birles-yazu__sheet {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: none !important;
  z-index: 14000 !important;
  display: block;
  pointer-events: none;
  transform: none !important;
  filter: none !important;
  contain: none !important;
}

.birles-yazu__sheet[hidden],
body > .birles-yazu__sheet[hidden] {
  display: none !important;
}

.birles-yazu__sheet.is-open,
body > .birles-yazu__sheet.is-open {
  pointer-events: auto;
}

.birles-yazu__sheet-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  --yu-ink: #1a2a3a;
  --yu-gold: #c9a227;
  --yu-paper: #fff8ec;
  --yu-teal: #1a6b68;
  --paper: #fff8ec;
  background: #efe4cc;
}

.birles-yazu__wide-word {
  flex: 0 0 auto;
  margin: max(10px, env(safe-area-inset-top, 0px)) 56px 0 16px;
  font-family: "TemelYazi", "ComfortaaOkul", "Comfortaa", sans-serif;
  font-size: clamp(1.35rem, 4.2vw, 2rem);
  font-weight: 800;
  color: #1a2a3a;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.birles-yazu__wide-prog {
  flex: 0 0 auto;
  margin: 2px 56px 6px 16px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #1a6b68;
}

.birles-yazu__stage--wide {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 4px 10px 8px;
  box-sizing: border-box;
  touch-action: none;
}

.birles-yazu__wide-tools {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 12px max(10px, env(safe-area-inset-bottom, 0px));
}

.birles-yazu__wide-tool {
  min-height: 42px;
  padding: 8px 16px;
  border: 0;
  border-radius: 14px;
  font-family: "ComfortaaOkul", "Comfortaa", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  color: #0f3d32;
  background: linear-gradient(165deg, #9dffc4, #1fad6a);
}

.birles-yazu__wide-tool--listen {
  color: #fff;
  background: linear-gradient(165deg, #5fd0ff, #1b6fd4);
}

.birles-yazu__sheet-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  z-index: 6;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 248, 230, 0.92);
  color: #6b4e12;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.birles-yazu__stage--wide .birles-yazu__svg {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none !important;
  background: #fff8ec;
  border-radius: 22px;
}

.birles-yazu__stage--wide .birles-yazu__paper,
body > .birles-yazu__sheet .birles-yazu__paper {
  fill: #fff8ec !important;
  stroke: rgba(201, 162, 39, 0.32);
}

.birles-yazu__wide-hint {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 7;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(26, 107, 104, 0.9);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 800;
  pointer-events: none;
}

.birles-yazu__wide-hint[hidden] {
  display: none !important;
}

@media (min-width: 720px) {
  .birles-yazu__words {
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
  }
}

/* 125 masaüstünde gizler — büyük tahta her cihazda açık kalsın */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .birles-yazu__wide-btn {
    display: flex !important;
  }
  .birles-yazu__sheet,
  body > .birles-yazu__sheet {
    display: block !important;
  }
  .birles-yazu__sheet[hidden],
  body > .birles-yazu__sheet[hidden] {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .birles-yazu__seal {
    width: 48px;
    height: 48px;
    font-size: 1.45rem;
  }
  .birles-yazu__svg {
    max-height: none;
    height: 100%;
  }
  .birles-yazu__word {
    min-height: 40px;
    font-size: clamp(0.95rem, 3.6vw, 1.12rem);
  }
  .birles-yazu-act small {
    display: none;
  }
  .birles-yazu-act {
    min-height: 62px;
    gap: 4px;
  }
}

@media (max-height: 900px) {
  .birles-yazu__badge {
    display: none;
  }
  .birles-yazu__hero {
    grid-template-rows: auto auto;
    padding: 8px 12px;
  }
  .birles-yazu__seal {
    grid-row: 1 / span 2;
  }
  .birles-yazu__wide-btn small {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .birles-yazu {
    gap: 6px;
  }
  .birles-yazu__hero {
    grid-template-columns: auto 1fr auto;
  }
  .birles-yazu__seal {
    grid-row: 1 / span 2;
  }
  .birles-yazu__progress-row {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .birles-yazu__word,
  .birles-yazu-act,
  .birles-yazu__meter > i {
    transition: none !important;
  }
}
