/* ==========================================================
   Polish layer (design research items 2–12). Loaded last.
   ========================================================== */
:root { --pink-ink: #c2187a; --osk-h: 0px; }

/* 6 — pink stays a fill; text in pink uses the darker ink for contrast */
.err, .chip.bad, .btn.danger { color: var(--bad-700, #b4232f) !important; }
.btn.danger { border-color: var(--pink-ink); }

/* 7 — riso overprint: ink layer + offset pink/blue layers that multiply on paper */
.titles h1, .brand-txt b, .win h2, .profile-head h2 { position: relative; text-shadow: none; }
.titles h1::before, .titles h1::after, .brand-txt b::before, .brand-txt b::after, .win h2::before, .win h2::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; z-index: -1; }
.titles h1::before, .brand-txt b::before, .win h2::before { color: rgba(255, 72, 176, .9); transform: translate(2px, 1px); }
.titles h1::after, .brand-txt b::after, .win h2::after { color: rgba(0, 120, 191, .55); transform: translate(-2px, -1px); }
.titles h1, .win h2 { isolation: isolate; }

/* 3 — letter stamp, 120 ms with overshoot and a pink ink kiss */
.c.let.typed { animation: stamp2 120ms cubic-bezier(.2, .9, .3, 1.4); }
@keyframes stamp2 { from { transform: scale(1.12); box-shadow: inset 0 0 0 2.5px var(--ink), 0 0 0 var(--pink); } to { transform: scale(1); box-shadow: inset 0 0 0 2.5px var(--ink), 3px 3px 0 var(--pink); } }

/* 4 — correct word: highlighter sweeps across the cells, 40 ms stagger, then settles */
.c.let.flip { animation: none !important; }
.c.let.flip::before { content: ""; position: absolute; inset: 18% -1px; background: var(--yellow); mix-blend-mode: multiply; transform: scaleX(0); transform-origin: left; animation: sweep 300ms ease-out forwards, settle 900ms 700ms ease forwards; animation-delay: calc(var(--i) * 40ms), calc(700ms + var(--i) * 40ms); pointer-events: none; }
@keyframes sweep { to { transform: scaleX(1); } }
@keyframes settle { to { opacity: .35; } }

/* 5 — wrong letter: gentle shake, no red flood; pink underline that fades */
.c.let.bad { color: var(--ink) !important; background: var(--paper) !important; text-decoration: none !important; animation: nudge 280ms ease-in-out; }
.c.let.bad::before { content: ""; position: absolute; left: 18%; right: 18%; bottom: 14%; height: 2px; background: var(--pink); animation: fadeLine 600ms 900ms forwards; }
@keyframes nudge { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes fadeLine { to { opacity: .55; } }

/* 9 — level-end rubber stamp */
.seal { position: absolute; top: 18px; right: 18px; transform: rotate(-8deg); font: 700 .8rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--pink-ink); border: 3px double var(--pink-ink); padding: 8px 10px; border-radius: 4px; mix-blend-mode: multiply; filter: url(#ink-rough); animation: sealIn 400ms cubic-bezier(.3, 1.4, .5, 1) 350ms both; }
.seal.fail { color: var(--blue); border-color: var(--blue); }
@keyframes sealIn { from { transform: scale(2) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(-8deg); opacity: .92; } }
.win { position: relative; }
.win .mascot { width: 84px; height: 84px; margin: -4px auto 4px; display: block; }

/* 12 — mascot */
.mascot { width: 96px; height: 96px; overflow: visible; }
.mascot .blot path { fill: var(--ink); }
.mascot .blot path[opacity] { fill: var(--pink); }
.mascot .face { stroke-width: 0; }
.mascot .face [fill="none"] { stroke: var(--paper); }
.mascot .face text { fill: var(--paper); }
.mascot.bob { animation: blob 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes blob { 50% { transform: scale(1.04, .96) translateY(2px); } }
.empty .mascot, .review-empty .mascot { width: 110px; height: 110px; margin: 0 auto; display: block; }
.review-empty > .i { display: none; }
.daily-card .mascot { position: absolute; right: 18px; bottom: 12px; width: 78px; height: 78px; }
.daily-card .mascot .blot path:not([opacity]) { fill: var(--paper); }
.daily-card .mascot .face { fill: var(--ink); stroke: var(--ink); }
.daily-card .mascot .face [fill="none"] { stroke: var(--ink); }
.daily-card { position: relative; }

/* 12 — badges as rubber stamps */
.badge.on { position: relative; }
.badge.on .i { width: 44px; height: 44px; padding: 8px; border-radius: 50%; border: 2.5px double var(--pink-ink); color: var(--pink-ink) !important; fill: none !important; transform: rotate(var(--rot, -6deg)); filter: url(#ink-rough); mix-blend-mode: multiply; }
.badge.on:nth-child(3n) .i { --rot: 5deg; border-color: var(--blue); color: var(--blue) !important; }
.badge.on:nth-child(3n+1) .i { --rot: -9deg; }
.badge:not(.on) .i { width: 44px; height: 44px; padding: 8px; border-radius: 50%; border: 1.5px dashed var(--ink-3); }

/* 8 — mobile: keyboard + clue bar live together in the thumb zone; swipe the bar to change clue */
@media (pointer: coarse) and (max-width: 860px) {
  :root { --osk-h: 176px; }
  .board { display: flex; flex-direction: column; }
  .board .cluebar { order: 9; position: sticky; bottom: calc(62px + var(--osk-h) + env(safe-area-inset-bottom)); z-index: 7; margin: 0 -16px; padding: 8px 16px; min-height: 52px; background: var(--paper); border-top: 1.5px solid var(--ink); border-bottom: 0; touch-action: pan-y; }
  .board .cluebar .clue-text { font-size: 1.25rem; }
  .board .osk { order: 10; gap: 6px; height: var(--osk-h); justify-content: center; }
  .osk .row { gap: 4px; }
  .osk button { height: 46px; min-width: 0; }
  .board .stage3d { order: 5; }
  .board .skin-tag { order: 4; }
  .cluebar::before { content: "‹ kaydır ›"; position: absolute; right: 10px; top: 4px; font: 500 .56rem var(--mono); letter-spacing: .12em; color: var(--ink-3); }
}

/* 11 — Çini (İznik tile) stage skin */
body[data-skin="cini"] { --cobalt: #1f4e9c; --turq: #1fa3a0; --cini-red: #d9483b; }
body[data-skin="cini"] .grid { background-color: #fbfaf5; border: 3px solid var(--cobalt); box-shadow: 0 0 0 6px #fbfaf5, 0 0 0 8px var(--turq), 8px 10px 0 8px rgba(31, 78, 156, .25); }
body[data-skin="cini"] .c.blk { background: #fbfaf5; background-image: radial-gradient(circle at 50% 50%, var(--turq) 0 2px, transparent 2.5px), radial-gradient(circle at 0 0, rgba(31, 78, 156, .25) 0 3px, transparent 3.5px), radial-gradient(circle at 100% 100%, rgba(31, 78, 156, .25) 0 3px, transparent 3.5px); }
body[data-skin="cini"] .c.let { background: #fff; color: var(--cobalt); outline-color: rgba(31, 78, 156, .35); font-family: 'Fraunces', serif; }
body[data-skin="cini"] .c.let.word { background: #e4f3f2; }
body[data-skin="cini"] .c.let.cur { background: var(--turq); color: #fff; box-shadow: inset 0 0 0 2.5px var(--cobalt); }
body[data-skin="cini"] .c.let.ok { color: var(--turq); }
body[data-skin="cini"] .c.clue { background: var(--cobalt); color: #fff; background-image: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, .25) 0 30%, transparent 31%); }
body[data-skin="cini"] .c.clue em { color: #ffd2cc !important; }
body[data-skin="cini"] .c.clue.hl { background: var(--cini-red); }
body[data-skin="cini"] .board .cluebar { border-bottom: 3px solid var(--cobalt); }
body[data-skin="cini"] .clue-text mark { background-image: linear-gradient(100deg, transparent .2em, #bfe7e5 .2em, #bfe7e5 calc(100% - .3em), transparent calc(100% - .3em)); }
body[data-skin="cini"] .stage3d { position: relative; }
body[data-skin="cini"] .stage3d::before { content: ""; position: absolute; top: 4px; left: 50%; width: 120px; height: 18px; margin-left: -60px; background: radial-gradient(circle, var(--cini-red) 0 4px, transparent 4.5px) 0 50% / 24px 18px repeat-x, linear-gradient(var(--cobalt), var(--cobalt)) 50% 50% / 100% 2px no-repeat; }

/* 2 — reduced motion (OS setting or in-app switch) */
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
body.calm .grid { transform: none !important; }
body.calm #confetti { display: none; }
.c.clue.hl em { color: var(--yellow) !important; }
body[data-skin="cini"] .c.clue.hl em { color: #fff !important; }

/* Stage skins bring their own board: drop the newspaper hatch, hairlines and zero-gap grid */
body[data-skin="chalk"] .grid, body[data-skin="notebook"] .grid, body[data-skin="cork"] .grid { gap: 4px; padding: 12px; }
body[data-skin="chalk"] .c.blk, body[data-skin="notebook"] .c.blk, body[data-skin="cork"] .c.blk { background: transparent; background-image: none; }
body[data-skin="chalk"] .c.let, body[data-skin="chalk"] .c.clue, body[data-skin="notebook"] .c.let, body[data-skin="notebook"] .c.clue, body[data-skin="cork"] .c.let, body[data-skin="cork"] .c.clue { outline: 0; }
body[data-skin="chalk"] .c.clue.hl em, body[data-skin="cork"] .c.clue.hl em { color: #fff !important; }
body[data-skin="chalk"] .c.clue em { color: #f6f2e6 !important; }
body[data-skin="chalk"] .clue-text mark { background: none; color: #f6f2e6; border-bottom: 2px dashed #ffe680; padding-bottom: 2px; }
body[data-skin="chalk"] .cluebar .tag { background: #f6f2e6; color: #2f4f3f !important; padding: 2px 8px; }

/* ---------- Learning path: section headers + unit actions ---------- */
.section-head { margin: 26px 0 8px; padding: 18px 0 14px; border-top: 3px double var(--ink); display: grid; gap: 4px; }
.section-head:first-child { margin-top: 0; }
.section-head small { font: 600 .68rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--pink-ink); }
.section-head h2 { font-size: clamp(2rem, 1.6rem + 1.6vw, 3rem); font-style: italic; line-height: 1; }
.section-head p { margin: 2px 0 8px; font-style: italic; font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; }
.section-head .pbar-wrap { max-width: 320px; }
.section-head .pbar-wrap i { background: var(--sc); }
.unit-acts { display: flex; gap: 8px; align-items: center; margin-right: 70px; }
.stage-head .unit-acts .pill { margin-right: 0; }
@media (max-width: 860px) { .unit-acts { margin-right: 50px; flex-direction: column; align-items: flex-end; } }

/* ---------- Unit guide ---------- */
.guide { text-align: left; }
.guide h2 { font-size: 2.2rem; margin: 6px 0; }
.guide-list { list-style: none; padding: 0; margin: 14px 0 18px; border-top: 1.5px solid var(--ink); }
.guide-list li { display: grid; grid-template-columns: 34px 110px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dotted rgba(27, 26, 23, .35); }
.guide-list b { font: 700 1.05rem var(--display); font-style: italic; letter-spacing: .02em; }
.guide-list span { color: var(--ink); }
.guide-list small { grid-column: 2 / -1; color: var(--ink-3); font-size: .82rem; font-style: italic; }

/* ---------- First run ---------- */
.onboard { position: fixed; inset: 0; z-index: 60; background: var(--paper); display: grid; place-items: center; padding: 24px 16px; overflow: auto; }
.onboard::before { content: ""; position: fixed; inset: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E"); opacity: .09; pointer-events: none; }
.ob-card { position: relative; width: min(560px, 100%); border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); padding: 26px 4px; animation: viewIn .45s var(--ease); }
.ob-card .mascot { width: 92px; height: 92px; display: block; margin-bottom: 8px; }
.ob-card h1 { font-size: clamp(2rem, 1.6rem + 2vw, 3.2rem); font-style: italic; line-height: 1; margin: 6px 0 10px; }
.ob-card p { font-size: 1.12rem; color: var(--ink-2); font-style: italic; margin: 0 0 18px; max-width: 44ch; }
.ob-word { font-size: clamp(2.6rem, 2rem + 4vw, 4.4rem) !important; letter-spacing: .02em; }
.ob-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ob-opts.col { grid-template-columns: 1fr; }
.ob-opts .btn { height: auto; min-height: 46px; padding: 10px 14px; justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 1.05rem; }
.ob-opts .btn small { font: 500 .7rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
@media (hover: hover) { .ob-opts .btn:hover small { color: var(--yellow); } }
.ob-opts .btn.right { background: var(--green); color: var(--paper); border-color: var(--green); }
.ob-opts .btn.wrong { background: var(--pink); color: var(--ink); }
.ob-skip { margin-top: 14px; }
.ob-step { display: flex; gap: 6px; margin-bottom: 10px; }
.ob-step i { width: 28px; height: 4px; background: var(--paper-2); border: 1px solid var(--ink); }
.ob-step i.on { background: var(--ink); }
body.onboarding .app { visibility: hidden; }
body[data-skin="notebook"] .cluebar .tag { color: #fff !important; }

/* ---------- Çengel Skoru ---------- */
.score-chip { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.score-chip .v small { font: 600 .62rem var(--mono); letter-spacing: .08em; margin-left: 4px; color: var(--pink-ink); vertical-align: super; }
@media (hover: hover) { .score-chip:hover { background: var(--yellow) !important; } }
.score-big { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 6px; }
.score-big b { font: 700 4.4rem/1 var(--display); font-style: italic; text-shadow: 3px 3px 0 var(--pink); }
.score-big span { font: 700 1.6rem var(--mono); border: 2px solid var(--ink); padding: 2px 8px; background: var(--yellow); }

/* ---------- Kelimelerim ---------- */
.my-words { margin-top: 22px; max-width: 760px; margin-left: auto; margin-right: auto; }
.word-list { list-style: none; padding: 0; margin: 0; columns: 2 280px; column-gap: 28px; }
.word-list li { break-inside: avoid; display: grid; grid-template-columns: 30px 96px 1fr auto 52px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dotted rgba(27, 26, 23, .3); font-size: .92rem; }
.word-list b { font: 700 .95rem var(--display); font-style: italic; }
.word-list .cefr { font: 600 .62rem var(--mono); font-style: normal; border: 1px solid var(--ink); padding: 0 4px; }
.word-list .str { height: 7px; border: 1px solid var(--ink); background: linear-gradient(90deg, var(--ink) calc(var(--s) * 100%), transparent 0); }

/* ---------- Lesson: steps, warm-up, mistake replay ---------- */
.lesson-steps { display: flex; align-items: center; gap: 8px; font: 600 .68rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.lesson-steps > i { flex: 0 1 34px; height: 1.5px; background: repeating-linear-gradient(90deg, var(--ink-3) 0 4px, transparent 4px 7px); }
.lesson-steps span { display: inline-flex; align-items: center; gap: 6px; }
.lesson-steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%; font-size: .66rem; }
.lesson-steps span.on { color: var(--ink); }
.lesson-steps span.on b { background: var(--yellow); border-color: var(--ink); }
.lesson-steps span.done { color: var(--green); }
.lesson-steps span.done .i { width: 18px; height: 18px; }
body.in-lesson .board #bar, body.in-lesson .board .stage3d, body.in-lesson .board .osk, body.in-lesson .board .skin-tag, body.in-lesson .board .toolbar .tools { display: none; }
.lesson-pane { border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); padding: 22px 4px 26px; animation: viewIn .35s var(--ease); }
.warm { max-width: 560px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.warm-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.warm h2 { font-size: clamp(2rem, 1.6rem + 2vw, 3rem); font-style: italic; margin: 6px 0 0; }
.warm h2::first-letter { text-transform: uppercase; }
.warm-en { letter-spacing: .03em; }
.warm .ob-opts { width: 100%; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.tile { width: 46px; height: 50px; padding: 0; font: 700 1.3rem var(--display); font-style: italic; justify-content: center; }
.tile:disabled { opacity: .25; }
.new-tag { font: 700 .56rem var(--mono); font-style: normal; letter-spacing: .1em; color: var(--ink) !important; background: var(--yellow); border: 1px solid var(--ink); padding: 1px 4px; }
.lesson-mascot { position: fixed; right: 24px; bottom: 24px; z-index: 35; display: flex; align-items: center; gap: 8px; pointer-events: none; opacity: 0; transform: translateY(20px) scale(.9); transition: opacity .25s, transform .35s var(--spring); }
.lesson-mascot.show { opacity: 1; transform: none; }
.lesson-mascot .mascot { width: 64px; height: 64px; }
.lesson-mascot span { background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--pink); padding: 6px 10px; font: 600 .95rem var(--display); font-style: italic; }
@media (max-width: 860px) { .lesson-mascot { bottom: calc(76px + var(--osk-h)); right: 12px; } }


/* Puzzle first: the board gets the space, chrome steps back */
.stage3d { padding: 8px 0 12px; }
@media (min-width: 1181px) { .play { grid-template-columns: minmax(0, 1fr) 280px !important; gap: 28px !important; } }

/* ==========================================================
   Puzzle-first layout: the grid owns the screen, clues live in a drawer
   ========================================================== */
.play { grid-template-columns: 1fr !important; }
.board { max-width: 1100px; margin: 0 auto; width: 100%; }
.stage3d { min-height: 0; }
.clues { position: fixed !important; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); max-height: none !important; z-index: 45; overflow: auto; background: var(--paper, #fff) !important; border: 0 !important; border-left: 2px solid var(--ink, #222) !important; padding: 18px 20px !important; transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); box-shadow: none; }
body.clues-open .clues { transform: none; box-shadow: -10px 0 40px rgba(0, 0, 0, .15); }
.clues-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(20, 20, 30, .25); opacity: 0; pointer-events: none; transition: opacity .3s; }
body.clues-open .clues-scrim { opacity: 1; pointer-events: auto; }
.clues-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 1.2rem; }
#cluesBtn b { font-weight: 700; margin-left: 2px; }
@media (min-width: 1400px) {
  /* very wide screens: keep the list docked, the grid still gets most of the room */
  .play { grid-template-columns: minmax(0, 1fr) 320px !important; }
  .clues { position: sticky !important; top: 20px; transform: none; max-height: calc(100vh - 40px) !important; border-left: 1.5px solid var(--ink, #222) !important; z-index: 1; }
  .clues-top, .clues-scrim, #cluesBtn { display: none !important; }
}
.cluebar { gap: 12px; }
.bar-nav { flex: none; width: 40px; height: 40px; border: 1.5px solid var(--ink, #222); background: transparent; font: 600 1.5rem/1 var(--display, sans-serif); cursor: pointer; display: grid; place-items: center; border-radius: 50%; color: inherit; }
@media (hover: hover) { .bar-nav:hover { background: var(--yellow, #ffe94d); } }
.bar-count { margin-left: auto; font: 600 .8rem var(--mono, monospace); color: var(--ink-3, #888); }
.cluebar .extra { margin-left: 0 !important; }
