/* Meditează: night indigo and lamp gold over the 3D stage. The overlays are plain translucent fills that only fade and
   move (no backdrop blur, no blend modes, no masks): heavy CSS effects over WebGL can stall its frames. */
:root {
    --md-gold: #f3c97a;
    --md-gold-2: #ffe2a8;
    --md-indigo: #9aa4ff;
    --md-ink: #0b0a1d;
    --md-text: #ece9ff;
    --md-muted: #aaa6cc;
    --md-glass: rgba(14, 12, 36, .84);
    --md-line: rgba(243, 201, 122, .26);
    --md-red: #ff7a64;
    --md-blue: #8cc0ff;
}
body.mediteaza-page { background: #08071a; color: var(--md-text); overflow-x: clip; }
.md-main { width: min(100% - 32px, 1120px); margin: 0 auto; padding-top: 96px; padding-bottom: 46px; }
.md-intro { margin-bottom: 18px; }
.md-eyebrow { margin: 0 0 4px; color: var(--md-gold); font: 700 .78rem/1.2 system-ui, sans-serif; letter-spacing: .14em; }
.md-intro h1 { margin: 0 0 6px; font: 700 clamp(2rem, 4vw, 3rem)/1.05 Georgia, "Times New Roman", serif; color: #fff6e4; }
.md-intro p { margin: 0; max-width: 66ch; color: var(--md-muted); }

/* the stage */
.md-stage {
    position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; min-height: 440px; max-height: 84vh;
    border-radius: 18px; border: 1px solid var(--md-line); background: #07061a; box-shadow: 0 24px 70px #000b;
    color: var(--md-text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; outline: none;
}
.md-stage:focus-visible { box-shadow: 0 0 0 2px var(--md-gold), 0 24px 70px #000b; }
.md-stage:fullscreen, .md-stage:-webkit-full-screen { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; aspect-ratio: auto; }
.md-stage.is-max { position: fixed; inset: 0; z-index: 1052; width: 100vw; height: 100vh; max-height: none; border-radius: 0; border: 0; aspect-ratio: auto; }
.md-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.md-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--md-gold); letter-spacing: .06em; z-index: 1; }
.md-stage[data-ready] .md-loading { display: none; }
.md-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, rgba(255, 236, 196, .9), rgba(255, 214, 150, .35) 45%, rgba(255, 214, 150, 0) 75%); opacity: 0; pointer-events: none; z-index: 2; }
.md-flash.is-on { animation: md-flash 7s ease-in-out; }
@keyframes md-flash { 0% { opacity: 0; } 40% { opacity: .38; } 100% { opacity: 0; } }

/* the thoughts' words, over their orbs */
.md-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.md-thought {
    position: absolute; left: 0; top: 0; padding: 2px 9px; border-radius: 999px; white-space: nowrap; will-change: transform;
    font: 600 .8rem/1.5 system-ui, sans-serif; letter-spacing: .02em; opacity: 0; transition: opacity .3s;
}
.md-thought.is-red { background: rgba(80, 14, 10, .62); color: #ffd2c8; border: 1px solid rgba(255, 122, 100, .5); }
.md-thought.is-blue { background: rgba(10, 30, 80, .55); color: #d6e8ff; border: 1px solid rgba(140, 192, 255, .45); }

/* where you are: the anchors, or the theme and how far along */
.md-track { position: absolute; left: 16px; top: 14px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; max-width: calc(100% - 90px); transition: opacity .8s ease; }
.md-track li { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--md-glass); border: 1px solid rgba(255, 255, 255, .08); color: var(--md-muted); font-size: .8rem; }
.md-track li.is-now { color: #fff6e4; border-color: var(--md-gold); box-shadow: 0 0 0 3px rgba(243, 201, 122, .15); }
.md-track li.is-done { color: var(--md-gold); }
.md-track li.is-done b::after { content: " ✓"; }
.md-track .is-theme { gap: 8px; }
.md-prog { position: relative; display: block; width: 90px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.md-prog > i { position: absolute; inset: 0; background: var(--md-gold); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.md-hint { position: absolute; left: 16px; top: 54px; z-index: 3; margin: 0; padding: 4px 10px; border-radius: 8px; background: rgba(14, 12, 36, .6); color: var(--md-gold-2); font-size: .82rem; transition: opacity .8s ease; }
.md-hint:empty { display: none; }

/* the guide's words */
.md-guide { position: absolute; left: 50%; bottom: 26px; z-index: 3; width: min(760px, calc(100% - 200px)); transform: translateX(-50%); text-align: center; pointer-events: none; }
.md-caption {
    margin: 0; min-height: 1.3em; color: #fff7e8; font: 400 clamp(1.05rem, 2.1vw, 1.5rem)/1.4 Georgia, "Times New Roman", serif;
    text-shadow: 0 2px 14px #000, 0 0 3px #000; opacity: 0; transform: translateY(6px); transition: opacity .9s ease, transform .9s ease;
}
.md-caption.is-on { opacity: 1; transform: none; }
.md-cue { margin: 8px 0 0; min-height: 1.2em; color: var(--md-gold); font: 600 .95rem/1.2 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 1px 8px #000; }
.md-count { margin: 6px 0 0; color: var(--md-muted); font-size: .85rem; text-shadow: 0 1px 6px #000; }
.md-count:empty { display: none; }

/* the big round button: hold to breathe, press to set the stone down */
.md-action {
    position: absolute; right: 22px; bottom: 22px; z-index: 4; width: 104px; height: 104px; border-radius: 50%;
    border: 1px solid var(--md-line); background: radial-gradient(circle at 50% 40%, rgba(243, 201, 122, .25), rgba(14, 12, 36, .9) 70%);
    color: #fff6e4; display: grid; place-items: center; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
    font: 700 .85rem/1.15 system-ui, sans-serif; text-align: center; transition: transform .15s;
}
.md-action[hidden] { display: none; }
.md-action:active { transform: scale(.96); }
.md-action:focus-visible { outline: 2px solid var(--md-gold); outline-offset: 3px; }
.md-action small { font-weight: 500; color: var(--md-muted); }
.md-action svg { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); transform: rotate(-90deg); }
.md-ring-bg { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 4; }
.md-ring { --k: 0; fill: none; stroke: var(--md-gold); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 176; stroke-dashoffset: calc(176 - 176 * var(--k)); }
.md-action[data-kind="stone"] span { font-size: 1.5rem; }
.md-action[data-kind="stone"] small { font-size: .78rem; }

/* the tools */
.md-tools { position: absolute; top: 14px; right: 14px; z-index: 5; display: grid; gap: 8px; transition: opacity .8s ease; }
.md-round { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--md-line); background: var(--md-glass); color: var(--md-text); display: grid; place-items: center; cursor: pointer; }
.md-round:hover, .md-round[aria-pressed="true"] { background: rgba(243, 201, 122, .22); color: #fff; }
.md-round:focus-visible, .md-btn:focus-visible, .md-choice:focus-visible, .md-mode:focus-visible { outline: 2px solid var(--md-gold); outline-offset: 2px; }

.md-panel { position: absolute; top: 14px; right: 66px; bottom: 14px; z-index: 6; width: min(340px, calc(100% - 82px)); overflow: auto; padding: 14px 16px; background: rgba(14, 12, 36, .94); border: 1px solid var(--md-line); border-radius: 16px; animation: md-in .25s ease; }
@keyframes md-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.md-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.md-panel h2 { margin: 0; font: 700 1.15rem/1.2 Georgia, serif; color: #fff6e4; }
.md-x { border: 0; background: none; color: var(--md-muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.md-x:hover { color: #fff; }
.md-muted { color: var(--md-muted); font-size: .84rem; margin: 6px 0 0; }
.md-switch { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; cursor: pointer; }
.md-switch input { width: 18px; height: 18px; accent-color: var(--md-gold); }
.md-range { display: grid; gap: 4px; margin: 12px 0 0; }
.md-range input { accent-color: var(--md-gold); }
.md-select { display: grid; gap: 4px; margin: 10px 0 0; font-size: .85rem; }
.md-select[hidden] { display: none; }
.md-select select { min-height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--md-line); background: rgba(0, 0, 0, .35); color: var(--md-text); }

.md-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--md-line); background: rgba(255, 255, 255, .06); color: var(--md-text); font-weight: 600; cursor: pointer; }
.md-btn:hover { background: rgba(255, 255, 255, .12); }
.md-btn-main { background: linear-gradient(135deg, #f3c97a, #c98a4e); color: #2a1a08; border-color: transparent; }
.md-btn-main:hover { background: linear-gradient(135deg, #ffd99a, #dc9d5e); }

/* the cover */
.md-cover { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, rgba(8, 7, 26, .3), rgba(8, 7, 26, .72)); overflow: auto; }
.md-cover[hidden] { display: none; }
.md-cover-card { width: min(680px, 100%); padding: 18px 20px; border-radius: 18px; background: var(--md-glass); border: 1px solid var(--md-line); }
.md-cover-card h2 { margin: 0 0 12px; font: 700 1.7rem/1.1 Georgia, serif; color: #fff6e4; }
.md-cover-card h3 { margin: 16px 0 8px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--md-gold); }
.md-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.md-mode, .md-choice { display: grid; gap: 3px; text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--md-line); background: rgba(255, 255, 255, .05); color: var(--md-text); cursor: pointer; }
.md-mode .md-ico { font-size: 1.5rem; }
.md-mode b { font-size: 1rem; }
.md-mode small, .md-choice small { color: var(--md-muted); font-size: .78rem; line-height: 1.3; }
.md-mode[aria-pressed="true"], .md-choice[aria-pressed="true"] { border-color: var(--md-gold); background: rgba(243, 201, 122, .15); box-shadow: 0 0 0 1px var(--md-gold) inset; }
.md-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.md-themes .md-ico { font-size: 1.4rem; }
.md-anchors { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: a; }
.md-anchors li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; counter-increment: a; }
.md-anchors li::before { content: counter(a); color: var(--md-gold); font-weight: 700; }
.md-chips, .md-lengths, .md-mudras { display: flex; flex-wrap: wrap; gap: 8px; }
.md-chips .md-choice { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; }
.md-mudras .md-choice, .md-lengths .md-choice { flex: 1 1 140px; }
.md-mudra-img { display: block; width: 100%; aspect-ratio: 8 / 5; margin-bottom: 6px; border-radius: 10px; background: radial-gradient(circle at 50% 45%, rgba(243, 201, 122, .16), rgba(8, 7, 26, .6) 70%); object-fit: cover; }
.md-mudra-img[hidden] { display: none; }
.md-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.md-looks .md-choice { justify-items: center; text-align: center; padding: 8px 4px; }
.md-looks b { font-size: .82rem; }
.md-face { position: relative; width: 40px; height: 44px; }
.md-face::before { content: ""; position: absolute; left: 6px; top: 2px; width: 28px; height: 30px; border-radius: 50% 50% 46% 46%; background: var(--skin); box-shadow: inset 0 8px 0 var(--hair); }
.md-face::after { content: ""; position: absolute; left: 4px; bottom: 0; width: 32px; height: 12px; border-radius: 12px 12px 4px 4px; background: var(--top); }
/* your own: a dashed tile, and its editor under the faces */
.md-looks .md-choice.is-mine { border-style: dashed; }
.md-look-edit { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px dashed var(--md-line); background: rgba(243, 201, 122, .06); }
.md-look-edit[hidden] { display: none; }
.md-ed-name, .md-ed-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 6px 10px; margin: 0; }
.md-ed-name span, .md-ed-row > span { font-size: .8rem; font-weight: 600; }
.md-ed-row > :nth-child(3) { grid-column: 2; }
.md-ed-name input { min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--md-line); background: rgba(0, 0, 0, .35); color: var(--md-text); }
.md-ed-name input:focus-visible { outline: 2px solid var(--md-gold); outline-offset: 1px; }
.md-sws, .md-chips2 { display: flex; flex-wrap: wrap; gap: 6px; }
.md-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); background: var(--c); cursor: pointer; }
.md-swatch[aria-pressed="true"] { border-color: var(--md-gold); box-shadow: 0 0 0 2px rgba(243, 201, 122, .35); }
.md-chip { min-height: 30px; padding: 0 10px; border-radius: 15px; border: 1px solid var(--md-line); background: rgba(255, 255, 255, .05); color: var(--md-text); font-size: .8rem; cursor: pointer; }
.md-chip[aria-pressed="true"] { border-color: var(--md-gold); background: rgba(243, 201, 122, .2); }
.md-swatch:focus-visible, .md-chip:focus-visible { outline: 2px solid var(--md-gold); outline-offset: 2px; }
.md-narr-cover { margin-top: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--md-line); background: rgba(243, 201, 122, .06); font-size: .88rem; line-height: 1.35; }
.md-narr-cover b { color: var(--md-gold-2); }
.md-go { width: 100%; margin-top: 18px; min-height: 50px; font-size: 1.05rem; }
.md-cover-stats { margin: 10px 0 0; text-align: center; color: var(--md-muted); font-size: .85rem; }
.md-cover-stats:empty { display: none; }
.md-stage.is-cover .md-tools > :not(#md-t-full), .md-stage.is-cover .md-track, .md-stage.is-cover .md-hint, .md-stage.is-cover .md-guide, .md-stage.is-cover .md-action { display: none; }
.md-stage.is-cover .md-tools { z-index: 8; }

/* the end: a card low on the screen, the vision still going above it */
.md-end { position: absolute; left: 50%; bottom: 14px; z-index: 6; width: min(720px, calc(100% - 32px)); transform: translateX(-50%); animation: md-up .9s ease; }
.md-end[hidden] { display: none; }
@keyframes md-up { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translateX(-50%); } }
.md-end-card { padding: 12px 16px; border-radius: 18px; background: var(--md-glass); border: 1px solid var(--md-line); text-align: center; }
.md-end-card h2 { margin: 0 0 4px; font: 700 1.45rem/1.15 Georgia, serif; color: #fff6e4; }
.md-end-card > p { margin: 0 0 8px; font-size: .9rem; color: var(--md-muted); }
.md-end-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.md-end-stats li { display: grid; justify-items: center; min-width: 84px; padding: 4px 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.md-end-stats li > span { display: none; }
.md-end-stats b { font-size: 1.15rem; color: #fff6e4; }
.md-end-stats small { font-size: .72rem; color: var(--md-muted); }
.md-end-btns { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.md-stage.is-end .md-guide { bottom: auto; top: 16px; }
.md-stage.is-end .md-cue, .md-stage.is-end .md-count { display: none; }
.md-stage.is-end .md-action, .md-stage.is-end .md-hint { display: none; }

.md-toast { position: absolute; left: 50%; top: 16px; z-index: 7; max-width: min(480px, calc(100% - 140px)); padding: 10px 16px; border-radius: 12px; background: var(--md-glass); border: 1px solid var(--md-line); color: var(--md-text); text-align: center; transform: translateX(-50%); }
.md-toast.is-on { animation: md-toast 3.6s ease forwards; }
@keyframes md-toast { 0% { opacity: 0; } 8%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* a still mouse: the controls step back; in the Automatic mode everything but the guide's words goes */
.md-stage.is-idle .md-tools, .md-stage.is-idle .md-track, .md-stage.is-idle .md-hint { opacity: 0; pointer-events: none; }
.md-stage.is-idle[data-mode="auto"] .md-count { opacity: 0; }
.md-stage.is-idle[data-mode="auto"] { cursor: none; }
.md-stage.is-zen .md-tools > :not(#md-t-zen), .md-stage.is-zen .md-track, .md-stage.is-zen .md-hint, .md-stage.is-zen .md-count { display: none; }

.md-about { margin-top: 18px; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--md-line); background: rgba(255, 255, 255, .03); }
.md-about summary { cursor: pointer; font-weight: 700; color: var(--md-gold); }
.md-about li { margin: 8px 0; color: var(--md-muted); }
.md-about strong { color: var(--md-text); }
.md-about kbd { background: #1c1a3a; color: var(--md-gold-2); border: 1px solid var(--md-line); }
.md-powered { margin: 14px 0 0; color: var(--md-muted); font-size: .9rem; }
.md-powered a { color: var(--md-gold); }

/* phones: a taller stage, the guide above the button, panels over the stage */
@media (max-width: 720px) {
    .md-main { width: 100%; padding-left: 16px; padding-right: 16px; }
    .md-stage { aspect-ratio: 9 / 15; min-height: 0; max-height: calc(100svh - 76px); }
    .md-tools { top: 10px; right: 10px; grid-auto-flow: column; }
    .md-round { width: 38px; height: 38px; }
    .md-track { top: 58px; left: 10px; max-width: calc(100% - 20px); }
    .md-track li b { display: none; }
    .md-track li.is-now b, .md-track .is-theme b { display: inline; }
    .md-hint { top: 96px; left: 10px; right: 10px; }
    .md-guide { width: calc(100% - 28px); bottom: 18px; }
    .md-stage.has-action .md-guide { bottom: 126px; }
    .md-caption { font-size: 1.02rem; }
    .md-action { left: 50%; right: auto; bottom: 16px; margin-left: -48px; width: 96px; height: 96px; }
    .md-panel { top: 58px; right: 10px; left: 10px; bottom: 10px; width: auto; }
    .md-modes, .md-themes { grid-template-columns: 1fr; }
    .md-ed-name, .md-ed-row { grid-template-columns: 1fr; }
    .md-ed-row > :nth-child(3) { grid-column: 1; }
    .md-end { bottom: 10px; }
    .md-end-stats li { min-width: 76px; }
    .md-toast { top: 100px; max-width: calc(100% - 32px); }
}
@media (prefers-reduced-motion: reduce) { .md-flash.is-on, .md-panel, .md-toast.is-on, .md-end { animation: none; } .md-caption { transition: none; } }
