@font-face { font-family: "DejaVu Serif"; font-weight: 400; src: url("stage-ru/fonts/DejaVuSerif.ttf") format("truetype"); }
@font-face { font-family: "DejaVu Serif"; font-weight: 700; src: url("stage-ru/fonts/DejaVuSerif-Bold.ttf") format("truetype"); }
@font-face { font-family: "DejaVu Sans"; font-weight: 400; src: url("stage-ru/fonts/DejaVuSans.ttf") format("truetype"); }
@font-face { font-family: "DejaVu Sans"; font-weight: 700; src: url("stage-ru/fonts/DejaVuSans-Bold.ttf") format("truetype"); }

:root {
  --cream: #f6edd9;
  --cream-2: #efe2c4;
  --brown: #3d2a1c;
  --brown-2: #6b5240;
  --accent: #b5532f;
  --leaf: #5c7a4a;
  --serif: "DejaVu Serif", Georgia, serif;
  --sans: "DejaVu Sans", system-ui, sans-serif;
  --bar-h: 72px;
  --cap-h: 92px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #2b2018; color: var(--brown); font-family: var(--serif);
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--cream); }

#stagearea { position: relative; flex: 1 1 auto; min-height: 0; background: #2b2018; overflow: hidden; }
iframe.stage { position: absolute; left: 0; top: 0; width: 1024px; height: 768px; border: 0; transform-origin: 0 0; background: #000; }
#overlay { position: absolute; left: 0; top: 0; touch-action: manipulation; z-index: 5; }
#outlines { position: absolute; inset: 0; pointer-events: none; }
.outline { position: absolute; border: 3px solid rgba(255, 248, 225, .95); border-radius: 14px;
  box-shadow: 0 0 0 2px rgba(61, 42, 28, .55), 0 0 18px 4px rgba(255, 240, 200, .55); pointer-events: none;
  opacity: 0; transition: opacity .35s ease; }
.outline.show { opacity: 1; }
.outline .tag { position: absolute; background: rgba(61,42,28,.85);
  color: #fff6df; font: 700 14px var(--sans); padding: 2px 8px; border-radius: 8px; white-space: nowrap; }

#caption { flex: 0 0 var(--cap-h); display: flex; align-items: center; justify-content: center; padding: 6px 22px;
  background: var(--cream); border-top: 3px solid var(--cream-2); cursor: pointer; }
#caption { overflow: hidden; align-items: stretch; }
#caption-text { position: relative; flex: 1 1 auto; height: calc(var(--cap-h) - 12px); overflow: hidden; transition: opacity .3s; }
#caption-inner { position: absolute; left: 0; right: 0; top: 0; font-size: 26px; line-height: 1.25; text-align: center; }
#caption-text.dim { opacity: .45; }
#caption-more { position: absolute; right: 4px; bottom: 0; font: 700 22px var(--sans); color: var(--accent); background: var(--cream); padding: 0 6px; display: none; }
#caption-text.more #caption-more { display: block; }
#caption-text .sp { font: 700 15px var(--sans); color: var(--accent); margin-right: 10px; letter-spacing: .02em; }
.w { border-radius: 8px; padding: 0 2px; transition: background .12s; }
.w.hi { background: #f5cf7a; }

#controls { flex: 0 0 var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--cream-2); border-top: 3px solid #e2d1ab; }
.ctl { min-width: 56px; height: 56px; border: 0; border-radius: 16px; background: var(--cream); color: var(--brown);
  font: 700 20px var(--sans); box-shadow: 0 2px 0 #cdb98c; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; cursor: pointer; }
.ctl:active { transform: translateY(2px); box-shadow: none; }
.ctl svg { width: 30px; height: 30px; fill: currentColor; }
#btn-play { background: var(--accent); color: #fff6df; box-shadow: 0 2px 0 #843b20; width: 72px; }
.lang span { padding: 4px 8px; border-radius: 10px; opacity: .5; }
.lang span.on { background: var(--brown); color: var(--cream); opacity: 1; }
#rates { display: flex; gap: 6px; }
.rate { font-size: 17px; padding: 0 10px; min-width: 56px; }
.rate.on { background: var(--brown); color: var(--cream); }
#btn-help.on { background: var(--leaf); color: #fff; }
#clock { font: 400 16px var(--sans); color: var(--brown-2); min-width: 54px; text-align: right; }
#scrubwrap { flex: 1 1 auto; display: flex; align-items: center; height: 56px; margin: 0 14px; }
#scrub { position: relative; width: 100%; height: 26px; border-radius: 13px; background: #d9c8a0; touch-action: none; cursor: pointer; }
#scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 13px; background: var(--accent); pointer-events: none; }
#scrub-thumb { position: absolute; top: 50%; left: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 13px; background: var(--brown);
  border: 3px solid var(--cream); pointer-events: none; }

#ui { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#ui:has(#backdrop) { pointer-events: auto; }
#ui > * { pointer-events: auto; }

/* the card */
#backdrop { position: absolute; inset: 0; background: rgba(43, 32, 24, .55); display: flex; align-items: center; justify-content: center;
  animation: fade .18s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
#card { position: relative; width: min(860px, 96vw); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; background: var(--cream); border-radius: 26px;
  border: 4px solid #d8c498; box-shadow: 0 14px 40px rgba(0,0,0,.45); padding: 20px 30px 18px; text-align: center; }
.card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-top: 6px; }
#card .card-btns { flex: 0 0 auto; padding-top: 6px; }
#card-close { position: absolute; right: 10px; top: 10px; width: 64px; height: 64px; border-radius: 32px; border: 0; background: var(--brown);
  color: var(--cream); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
#card-close svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 4; stroke-linecap: round; fill: none; }
#card-back { position: absolute; left: 10px; top: 10px; width: 64px; height: 64px; border-radius: 32px; border: 0; background: var(--cream-2);
  color: var(--brown); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
#card-back svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.card-who { font: 700 21px var(--sans); color: var(--accent); margin: 0 70px 4px; min-height: 20px; }
.card-en { font-size: 34px; line-height: 1.3; margin: 4px 40px 8px; }
.card-en .w { cursor: pointer; padding: 2px 4px; display: inline-block; }
.card-en .w { border-bottom: 2px dotted rgba(107, 82, 64, .45); background: rgba(245, 207, 122, .16); border-radius: 8px 8px 3px 3px; }
.card-en .w.hi { background: #f5cf7a; }
.card-en .w:active { background: #f5cf7a; }
.card-ru { font-size: 21px; line-height: 1.3; color: var(--brown-2); margin: 0 30px 16px; }
.card-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.big { min-width: 130px; height: 64px; border: 0; border-radius: 20px; background: var(--accent); color: #fff6df; font: 700 20px var(--sans);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; box-shadow: 0 3px 0 #843b20; cursor: pointer; }
.big.alt { background: var(--leaf); box-shadow: 0 3px 0 #3f5832; }
.big.quiet { background: var(--cream-2); color: var(--brown); box-shadow: 0 3px 0 #cdb98c; }
.big svg { width: 28px; height: 28px; fill: currentColor; }
.big:active { transform: translateY(3px); box-shadow: none; }
.hint { font: 400 15px var(--sans); color: var(--brown-2); margin-top: 12px; }

.word-big { font-size: 76px; font-weight: 700; margin: 6px 70px 0; line-height: 1.1; }
.word-ru { font-size: 30px; color: var(--brown-2); margin: 4px 0 8px; }
.word-note { font: 400 19px/1.35 var(--sans); background: var(--cream-2); border-radius: 16px; padding: 10px 16px; margin: 10px auto 6px; max-width: 640px; }
.letters { display: flex; justify-content: center; gap: 8px; min-height: 112px; margin: 14px 0 4px; flex-wrap: wrap; }
.ltr { width: 82px; height: 104px; border-radius: 20px; background: #fff9ea; border: 3px solid #d8c498; display: flex; align-items: center; justify-content: center;
  font: 700 70px var(--sans); color: var(--brown); opacity: 0; transform: scale(.4) translateY(14px); transition: opacity .25s, transform .25s; }
.ltr.show { opacity: 1; transform: none; }
.ltr.now { background: #f5cf7a; border-color: var(--accent); }
.ltr.apos { width: 40px; }

/* thing label */
#label { position: absolute; display: flex; align-items: stretch; background: var(--cream); border: 3px solid #d8c498; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(0,0,0,.4); overflow: hidden; animation: pop .16s ease; transform-origin: 50% 100%; }
@keyframes pop { from { transform: scale(.7); opacity: 0 } to { transform: none; opacity: 1 } }
#label .l-main { padding: 6px 18px; min-width: 96px; min-height: 64px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  border: 0; background: transparent; cursor: pointer; font-family: var(--serif); color: var(--brown); }
#label .l-en { font-size: 32px; font-weight: 700; line-height: 1.1; }
#label .l-ru { font: 400 15px var(--sans); color: var(--brown-2); margin-top: 2px; }
#label .l-abc { width: 64px; min-height: 64px; border: 0; border-left: 3px solid #e2d1ab; background: var(--cream-2); color: var(--brown);
  font: 700 22px var(--sans); cursor: pointer; }
#label .l-x { display: none; }

/* first screen */
#start { position: absolute; inset: 0; z-index: 50; background: radial-gradient(ellipse at 50% 40%, #fbf4e3 0%, var(--cream) 55%, #e4d3ab 100%);
  display: flex; align-items: center; justify-content: center; text-align: center; }
.start-inner { max-width: 760px; padding: 20px; }
#start-title { font-size: 44px; font-weight: 700; line-height: 1.2; margin-bottom: 30px; }
#start-btn { width: 150px; height: 150px; border-radius: 75px; border: 0; background: var(--accent); color: #fff6df; box-shadow: 0 6px 0 #843b20, 0 14px 30px rgba(0,0,0,.25);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
#start-btn svg { width: 74px; height: 74px; fill: currentColor; margin-left: 8px; }
#start-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #843b20; }
#start-btn[disabled] { opacity: .5; }
#start-hint { font: 400 17px var(--sans); color: var(--brown-2); margin-top: 26px; }
body.started #start { display: none; }

@media (max-height: 600px) {
  :root { --bar-h: 64px; --cap-h: 76px; }
  #caption-inner { font-size: 22px; }
  .card-en { font-size: 28px; } .word-big { font-size: 56px; } .ltr { width: 66px; height: 82px; font-size: 54px; }
  .ctl { height: 56px; }
}
@media (max-width: 760px) { #rates .rate { min-width: 56px; padding: 0 6px; } #clock { display: none; } }

@media (max-height: 480px) {
  :root { --bar-h: 62px; --cap-h: 70px; }
  #card { padding: 10px 18px 10px; border-radius: 20px; }
  #card-close, #card-back { width: 56px; height: 56px; right: 6px; top: 6px; }
  #card-back { left: 6px; right: auto; }
  .card-who { margin: 0 64px 2px; min-height: 18px; font-size: 17px; }
  .card-en { font-size: 24px; margin: 2px 50px 4px; }
  .card-ru { font-size: 16px; margin: 0 20px 6px; }
  .word-big { font-size: 44px; margin: 0 64px; } .word-ru { font-size: 20px; margin: 0 0 4px; }
  .word-note { font-size: 15px; padding: 6px 12px; margin: 4px auto; }
  .letters { min-height: 62px; margin: 6px 0 2px; } .ltr { width: 48px; height: 58px; font-size: 38px; border-radius: 12px; }
  .big { height: 56px; min-width: 100px; font-size: 17px; padding: 0 14px; }
  .hint { display: none; }
  #label .l-en { font-size: 24px; }
  #controls { gap: 8px; padding: 0 8px; }
  #btn-play { width: 64px; }
}
