/* Promptoholik – papírové rozhraní nad 3D tělocvičnou */

@font-face { font-family: "Alfa Slab One"; font-weight: 400; font-display: swap;
  src: url("../fonts/alfa-slab-one-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Alfa Slab One"; font-weight: 400; font-display: swap;
  src: url("../fonts/alfa-slab-one-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Courier Prime"; font-weight: 400; font-display: swap;
  src: url("../fonts/courier-prime-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Courier Prime"; font-weight: 400; font-display: swap;
  src: url("../fonts/courier-prime-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Courier Prime"; font-weight: 700; font-display: swap;
  src: url("../fonts/courier-prime-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Courier Prime"; font-weight: 700; font-display: swap;
  src: url("../fonts/courier-prime-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap;
  src: url("../fonts/caveat-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap;
  src: url("../fonts/caveat-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #e9e1c3;       /* zažloutlý formulář */
  --paper-dark: #d6cba3;
  --ink: #29251f;
  --ink-soft: #5d5546;
  --olive: #66754a;       /* olejový sokl */
  --stamp: #b9362a;       /* razítko */
  --pencil: #ffcf33;
  --prompt: #8b5cff;      /* pokušení */
  --prompt-2: #39d0ff;
  --display: "Alfa Slab One", "Rockwell", Georgia, serif;
  --text: "Courier Prime", "Courier New", monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #1b1712; color: var(--ink);
  font-family: var(--text); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
body.playing #scene { cursor: none; }

/* ---------- efekty přes obrazovku ---------- */
#vignette, #flash, #whispers { position: fixed; inset: 0; pointer-events: none; }
#vignette {
  --crave: 0;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(84, 40, 190, calc(var(--crave) * .55)) 100%),
    radial-gradient(ellipse at center, transparent 55%, rgba(10, 8, 6, .55) 100%);
}
#flash { background: radial-gradient(ellipse at center, rgba(139, 92, 255, .12), rgba(139, 92, 255, .7)); opacity: 0; }
#flash.hit { animation: flash .55s ease-out; }
#flash.good { background: radial-gradient(ellipse at center, rgba(255, 216, 74, 0), rgba(255, 216, 74, .45)); animation: flash .6s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

#whispers span {
  position: absolute; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; font-size: 15px;
  color: #d9ccff; text-shadow: 0 0 14px var(--prompt); opacity: 0; white-space: nowrap;
  animation: whisper 2.6s ease-in-out forwards;
}
@keyframes whisper { 20%, 70% { opacity: .75; } to { opacity: 0; transform: translateY(-14px); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }

.card {
  position: absolute; top: calc(14px + var(--safe-t)); left: calc(14px + var(--safe-l));
  width: 252px; padding: 10px 12px 11px;
  background: var(--paper); border: 1.5px solid var(--ink);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, .35);
  transform: rotate(-1.2deg); transform-origin: top left;
}
.card-title { margin: 0 0 7px; font-family: var(--display); font-size: 14px; letter-spacing: .01em; }
.stamps { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.stamps li {
  flex: 1; aspect-ratio: 1; border: 1.5px dashed var(--ink-soft); border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; color: var(--ink-soft); position: relative;
}
.stamps li.today { border-style: solid; border-color: var(--ink); color: var(--ink); font-weight: 700; }
.stamps li.done::after {
  content: "čistý"; position: absolute; inset: -3px; border-radius: 50%;
  border: 2.5px solid var(--stamp); color: var(--stamp);
  display: grid; place-items: center; font-family: var(--display); font-size: 8.5px;
  transform: rotate(-18deg); background: rgba(233, 225, 195, .82);
  animation: stamp .28s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes stamp { from { transform: rotate(-18deg) scale(2.6); opacity: 0; } }
.card-day { display: flex; justify-content: space-between; margin: 8px 0 4px; font-size: 14px; font-weight: 700; }
.daybar { height: 5px; background: var(--paper-dark); border: 1px solid var(--ink); }
.daybar i { display: block; height: 100%; width: 0; background: var(--olive); }

.score { position: absolute; top: calc(14px + var(--safe-t)); right: calc(18px + var(--safe-r)); text-align: right; color: #fff8e6; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
.score-label { margin: 0; font-size: 14px; }
.score-value { margin: -2px 0 0; font-family: var(--display); font-size: 38px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.combo { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--pencil); min-height: 1.4em; }
.combo.bump { animation: bump .22s ease-out; }
@keyframes bump { from { transform: scale(1.35); } }

.will { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(18px + var(--safe-b)); width: min(330px, 62vw); }
.will-label { margin: 0 0 5px; font-weight: 700; font-size: 15px; color: #fff8e6; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
.pencil { display: flex; height: 20px; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .4)); }
.p-eraser { width: 16px; background: #f29aa8; border-radius: 5px 0 0 5px; }
.p-ferrule { width: 10px; background: repeating-linear-gradient(90deg, #c9c9c9 0 2px, #8f8f8f 2px 3px); }
.p-track { flex: 1; display: flex; }
.p-body {
  width: 100%; transition: width .35s cubic-bezier(.3, 1.3, .5, 1);
  background: linear-gradient(#ffe27a 0 30%, var(--pencil) 30% 70%, #d9a900 70%);
}
.p-tip { width: 24px; flex: none; background: linear-gradient(90deg, #e8c79a 0 68%, #2b2b2b 68%); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.will.low .p-body { background: linear-gradient(#ff9c8a 0 30%, #e5503c 30% 70%, #a8301f 70%); }
.will.low .will-label { color: #ffb0a3; }
.will.jolt { animation: jolt .3s; }
@keyframes jolt { 25% { transform: translateX(-6px); } 60% { transform: translateX(5px); } }

#crosshair {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 248, 230, .9); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .45);
}
#crosshair::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: var(--pencil); }
#crosshair.fire { animation: fire .16s ease-out; }
@keyframes fire { from { transform: scale(1.7); } }
body.touch #crosshair { display: none; }

.edge {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-family: var(--display); font-size: 74px; line-height: 1; color: #c9b5ff;
  text-shadow: 0 0 22px var(--prompt), 0 0 4px #000; opacity: 0; transition: opacity .15s;
}
.edge-l { left: calc(10px + var(--safe-l)); }
.edge-r { right: calc(10px + var(--safe-r)); }

#popups span {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-weight: 700; font-size: 17px; color: #fff8e6; text-shadow: 0 2px 0 rgba(0, 0, 0, .75);
  animation: pop 1s ease-out forwards;
}
#popups span.bad { color: #ff9c8a; }
#popups span.good { color: var(--pencil); }
@keyframes pop { from { opacity: 0; margin-top: 8px; } 15% { opacity: 1; } to { opacity: 0; margin-top: -46px; } }

#toast {
  position: absolute; left: 50%; top: 21%; transform: translateX(-50%) rotate(-.6deg);
  margin: 0; padding: 9px 16px; width: max-content; max-width: min(560px, 88vw); text-align: center;
  background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 3px 4px 0 rgba(0, 0, 0, .35);
  font-weight: 700; opacity: 0; transition: opacity .25s;
}
#toast.show { opacity: 1; }

#subtitle {
  position: absolute; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  margin: 0; padding: 7px 14px; width: max-content; max-width: min(680px, 90vw); text-align: center;
  background: rgba(20, 17, 13, .78); color: #fff8e6; font-size: 17px;
  opacity: 0; transition: opacity .3s;
}
#subtitle.show { opacity: 1; }
#subtitle b { color: var(--pencil); font-weight: 700; }

/* falešné chatové pole, když prompt doletí */
#relapse {
  position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  width: min(520px, 88vw); opacity: 0; transition: opacity .18s, transform .18s;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
#relapse.show { opacity: 1; transform: translateX(-50%); }
.relapse-box {
  display: flex; align-items: center; min-height: 52px; padding: 8px 8px 8px 20px;
  background: rgba(22, 17, 44, .95); color: #f4f1ff; font-size: 17px;
  border: 2px solid var(--prompt); border-radius: 28px; box-shadow: 0 0 34px rgba(139, 92, 255, .75);
}
.relapse-box .caret { width: 2px; height: 1.2em; margin-left: 2px; background: #fff; animation: blink .5s steps(2) infinite; }
.relapse-box .send { margin-left: auto; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--prompt), var(--prompt-2)); }
@keyframes blink { 50% { opacity: 0; } }
#relapseNote { margin: 6px 0 0; text-align: center; font-family: var(--text); font-weight: 700; color: #ff9c8a; text-shadow: 0 2px 0 rgba(0, 0, 0, .7); min-height: 1.4em; }

#pauseBtn {
  position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(18px + var(--safe-b));
  width: 46px; height: 46px; pointer-events: auto;
  background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 2px 3px 0 rgba(0, 0, 0, .35);
  font-family: var(--display); font-size: 15px; color: var(--ink); cursor: pointer;
}

/* ---------- papíry (menu, pauza, konec) ---------- */
.sheet-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)) max(20px, 6vw);
  overflow-y: auto; -webkit-user-select: text; user-select: text;
}
#pause, #over, #win { justify-content: center; padding-left: 20px; background: rgba(14, 11, 8, .55); }

.sheet {
  position: relative; width: min(500px, 100%); margin: auto 0; padding: 30px 32px 26px;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(41, 37, 31, .07) 31px 32px),
    var(--paper);
  border: 1.5px solid var(--ink); box-shadow: 7px 9px 0 rgba(0, 0, 0, .4);
  transform: rotate(-1deg);
}
.sheet-small { width: min(440px, 100%); transform: rotate(.7deg); }
.sheet-cert { width: min(520px, 100%); transform: rotate(-.5deg); outline: 1.5px solid var(--ink); outline-offset: -9px; padding: 38px 38px 30px; }

.sheet-kicker { margin: 0 0 6px; font-size: 15px; color: var(--ink-soft); }
.sheet h1, .sheet h2 { margin: 0; font-family: var(--display); font-weight: 400; line-height: .95; letter-spacing: -.01em; }
.sheet h1 { font-size: clamp(48px, 9.2vw, 70px); }
.sheet h2 { font-size: clamp(38px, 7vw, 52px); }
.lead { margin: 14px 0 0; max-width: 46ch; }
.fine { margin: 16px 0 0; font-size: 14px; color: var(--ink-soft); }

.rules { margin: 18px 0 0; padding: 0; list-style: none; }
.rules li { position: relative; padding: 0 0 0 28px; margin: 0 0 7px; }
.rules li::before { content: ""; position: absolute; left: 0; top: .22em; width: 14px; height: 14px; border: 1.5px solid var(--ink); }
.rules li:nth-child(2)::before { background: var(--prompt); }
.rules li:nth-child(3)::before { background: #ffd84a; }
.rules li:nth-child(4)::before { background: linear-gradient(135deg, transparent 44%, var(--stamp) 44% 56%, transparent 56%), linear-gradient(45deg, transparent 44%, var(--stamp) 44% 56%, transparent 56%); }

.trap { margin: 18px 0 0; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; }
.trap label { display: block; margin: 0 0 6px; font-family: var(--text); font-size: 15px; color: var(--ink-soft); }
.trap-row {
  display: flex; align-items: center; padding: 5px 5px 5px 18px;
  background: #16112c; border: 2px solid var(--prompt); border-radius: 26px;
  box-shadow: 0 0 22px rgba(139, 92, 255, .55);
}
.trap-row input { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: none; color: #f4f1ff; font: inherit; font-size: 16px; }
.trap-row input::placeholder { color: #9d93c9; }
.trap-row:focus-within { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--prompt), 0 0 30px rgba(139, 92, 255, .8); }
.trap-send { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--prompt), var(--prompt-2)); }
.trap-note { margin: 7px 0 0; min-height: 1.4em; font-family: var(--text); font-weight: 700; color: var(--stamp); }
.trap.caught .trap-row { animation: caught .45s ease-in forwards; }
@keyframes caught { 20% { transform: translateX(-7px) rotate(-1deg); } 45% { transform: translateX(6px) rotate(1deg); } to { transform: scale(.9) rotate(-3deg); opacity: .28; filter: grayscale(1); } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.btn {
  padding: 12px 20px; font: 700 17px var(--text); color: var(--ink); cursor: pointer;
  background: transparent; border: 1.5px solid var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn-main { background: var(--pencil); box-shadow: 4px 4px 0 var(--ink); font-family: var(--display); font-weight: 400; font-size: 19px; }
.btn-main:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn-main:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-main:disabled { background: var(--paper-dark); color: var(--ink-soft); cursor: progress; }
.btn-quiet:hover { background: rgba(41, 37, 31, .08); }
.btn:focus-visible, #pauseBtn:focus-visible { outline: 3px solid var(--prompt); outline-offset: 3px; }

.report { margin: 18px 0 0; }
.report div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1.5px dotted var(--ink-soft); }
.report dt { color: var(--ink-soft); }
.report dd { margin: 0; font-weight: 700; text-align: right; }

.seal {
  position: absolute; right: 22px; top: 20px; width: 104px; height: 104px; border-radius: 50%;
  border: 4px double var(--stamp); color: var(--stamp); display: grid; place-items: center; text-align: center;
  font-family: var(--display); font-size: 19px; line-height: 1.05; transform: rotate(14deg); opacity: .88;
}

.noscript { position: fixed; inset: auto 20px 20px; padding: 12px 16px; background: var(--paper); border: 1.5px solid var(--ink); }

/* ---------- malé displeje ---------- */
@media (max-width: 640px) {
  html, body { font-size: 16px; }
  .sheet-wrap { padding-left: 14px; padding-right: 14px; align-items: flex-start; }
  .sheet { padding: 22px 20px 20px; margin: auto; }
  .sheet h1 { font-size: 46px; }
  .lead { margin-top: 10px; }
  .rules { margin-top: 12px; } .rules li { margin-bottom: 4px; }
  .trap, .actions { margin-top: 13px; }
  .fine { margin-top: 11px; }
  .sheet-cert { padding: 30px 24px 24px; }
  .seal { width: 78px; height: 78px; font-size: 14px; right: 14px; top: 12px; }
  .card { width: 196px; padding: 8px 9px 9px; }
  .card-title { font-size: 12px; margin-bottom: 5px; }
  .stamps li { font-size: 9px; }
  .stamps li.done::after { font-size: 6.5px; border-width: 2px; }
  .card-day { font-size: 12.5px; }
  .score-value { font-size: 28px; }
  .score-label { font-size: 12.5px; }
  #subtitle { font-size: 15px; bottom: calc(78px + var(--safe-b)); }
  #toast { top: 24%; }
}
@media (max-height: 520px) {
  .rules { margin-top: 10px; } .rules li { margin-bottom: 3px; }
  .trap, .actions { margin-top: 12px; }
  .sheet h1 { font-size: 44px; }
  #toast { top: 30%; }
}

@media (prefers-reduced-motion: reduce) {
  #flash.hit, #flash.good, .will.jolt, .combo.bump, #crosshair.fire { animation: none; }
  .stamps li.done::after { animation: none; }
}

/* velké monitory: HUD ať není drobný */
@media (min-width: 1500px) and (min-height: 900px) {
  .card { zoom: 1.25; }
  .sheet { zoom: 1.3; }
  .will { zoom: 1.2; }
  .score-value { font-size: 48px; }
  .score-label, .combo { font-size: 17px; }
  #subtitle, #toast { font-size: 20px; }
  #popups span { font-size: 20px; }
}
@media (min-width: 1500px) and (min-height: 900px) {
  #crosshair { width: 30px; height: 30px; margin: -15px 0 0 -15px; border-width: 2.5px; }
  #crosshair::after { width: 6px; height: 6px; margin: -3px; }
}
