/* ===== THE SECRET WORLD — night noir violet ===== */
:root{
  --ink:#050308;
  --ink2:#0B0614;
  --panel:#120A1E;
  --violet:#7C3AED;
  --violet2:#A855F7;
  --gold:#E8D9B5;
  --champagne:#E8C97A;
  --silver:#C9CDD4;
  --ivory:#F5F2EA;
  --danger:#C2476B;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%;background:var(--ink);color:var(--ivory);
  font-family:'Cairo',system-ui,-apple-system,'Segoe UI',sans-serif;overflow:hidden;overscroll-behavior:none}
body{user-select:none;-webkit-user-select:none;touch-action:manipulation}
button{font-family:inherit;color:inherit;border:0;background:none;cursor:pointer}
.hide{display:none !important}
.center{text-align:center}
.tiny{font-size:11px;color:#8C87A0;margin:0}
.off{display:none !important}

#game-root{position:relative;display:flex;flex-direction:column;height:100%;background:var(--ink);overflow:hidden}

/* ================= HUD ================= */
#hud{position:relative;flex:0 0 auto;z-index:80;pointer-events:auto;padding:7px 9px 6px;
  background:linear-gradient(180deg,#0B0614 0%,#0B0614f2 70%,#0B0614d9 100%);
  border-bottom:1px solid #ffffff12;box-shadow:0 8px 22px -18px #000}
.hud-main{display:flex;align-items:center;gap:6px;min-width:0}
.hud-stats{display:flex;align-items:center;gap:5px;flex:0 0 auto}
.chip{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 7px;border-radius:999px;
  background:#170E26;border:1px solid #7C3AED3d;font-size:12px;font-weight:700;color:var(--gold);line-height:1}
.chip .ico{width:12px;height:12px;fill:var(--champagne)}
.chip .ico.heart{fill:#E06A8A}
.chip.timer{color:#D9D3E8;font-weight:600;letter-spacing:.02em;font-variant-numeric:tabular-nums;min-width:44px;justify-content:center}
.chip.timer.low{color:#FF9DB6;border-color:#C2476B66;background:#2A0E1A}
.hud-goal{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:1px;overflow:hidden;padding-inline-start:2px}
.hud-goal span{font-family:'Amiri',serif;font-size:13px;font-weight:700;color:var(--violet2);line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hud-goal em{font-style:normal;font-size:10.5px;color:#9B93B4;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hud-pause{flex:0 0 auto;width:34px;height:34px;border-radius:10px;background:#170E26;border:1px solid #ffffff14;
  display:grid;place-items:center;color:#B9B2CC;cursor:pointer;touch-action:manipulation;pointer-events:auto}
.hud-pause svg{width:15px;height:15px;fill:currentColor}
.hud-pause:active{background:#241540}
.stamina{margin-top:6px;height:3px;border-radius:99px;background:#ffffff10;overflow:hidden}
.stamina i{display:block;height:100%;width:100%;border-radius:99px;
  background:linear-gradient(90deg,#8A6A34,#E8C97A,#F3E3B8);transition:width .12s linear}

/* ================= STAGE ================= */
#stage{position:relative;flex:1 1 auto;min-height:0;overflow:hidden;background:#0A0614}
#world{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
#touch-layer{position:absolute;inset:0;z-index:2;touch-action:none}
#flash{position:absolute;inset:0;pointer-events:none;z-index:3;background:radial-gradient(circle at 50% 55%,#C2476B00 30%,#C2476Bcc 100%);
  opacity:0;transition:opacity .32s ease-out}
#flash.on{opacity:1;transition:opacity .06s}

#joystick{position:absolute;left:18px;bottom:18px;width:112px;height:112px;border-radius:50%;z-index:4;
  pointer-events:none;opacity:0;transition:opacity .18s ease;
  background:radial-gradient(circle,#A855F71c 0%,#A855F70d 62%,transparent 72%);
  border:1px solid #A855F73d}
#joystick.on{opacity:1}
#joy-knob{position:absolute;left:50%;top:50%;width:48px;height:48px;margin:-24px 0 0 -24px;border-radius:50%;
  background:radial-gradient(circle at 34% 30%,#C9A7FF,#7C3AED 72%);
  box-shadow:0 0 18px -2px #A855F7aa,inset 0 1px 0 #ffffff55;border:1px solid #C4A5FF66}

.hintbar{position:absolute;left:50%;top:10px;transform:translateX(-50%);z-index:3;
  max-width:calc(100% - 24px);padding:6px 12px;border-radius:999px;font-size:11px;color:#B9B0D0;text-align:center;
  background:#0B0614cc;border:1px solid #ffffff14;backdrop-filter:blur(8px);transition:opacity .6s ease;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.hintbar.gone{opacity:0}

.toast{position:absolute;left:50%;top:48px;transform:translateX(-50%);z-index:5;max-width:calc(100% - 28px);
  padding:8px 14px;border-radius:12px;font-size:12.5px;font-weight:600;color:var(--ivory);text-align:center;
  background:#1A0F2Ee6;border:1px solid #A855F755;box-shadow:0 14px 30px -18px #A855F7;
  animation:toastIn .28s ease-out both}
@keyframes toastIn{from{opacity:0;transform:translate(-50%,-8px)}to{opacity:1;transform:translate(-50%,0)}}

.subtitle{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);z-index:5;
  width:calc(100% - 32px);max-width:520px;padding:10px 14px;border-radius:14px;
  background:#08040Ff0;border:1px solid #A855F74d;box-shadow:0 18px 44px -22px #A855F7;
  font-size:13px;line-height:1.65;color:#EDE7DA;text-align:center;animation:subIn .3s ease-out both}
@keyframes subIn{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translate(-50%,0)}}
.subtitle .who{display:block;font-family:'Amiri',serif;font-size:11px;color:var(--violet2);margin-bottom:2px}

/* ================= CONTROLS DOCK ================= */
#controls{position:relative;flex:0 0 auto;z-index:80;pointer-events:auto;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:8px 14px;background:linear-gradient(0deg,#0B0614,#0B0614f0);border-top:1px solid #ffffff12}
.ctrl-group{display:flex;align-items:center;gap:10px}
.pad-btn{position:relative;display:grid;place-items:center;gap:1px;border-radius:20px;cursor:pointer;
  background:linear-gradient(170deg,#1D1230,#120A1E);border:1px solid #ffffff1a;color:#CFC7E0;
  touch-action:manipulation;pointer-events:auto;
  transition:transform .1s ease,background .15s ease,box-shadow .15s ease}
.pad-btn span{font-size:9.5px;font-weight:600;color:#9B93B4;line-height:1}
.pad-btn svg{width:22px;height:22px;fill:currentColor;stroke:currentColor;stroke-width:0}
.pad-btn.small{width:62px;height:56px}
.pad-btn.big{width:82px;height:64px;border-radius:22px;color:#F0E5FF;
  background:linear-gradient(165deg,#3B1E67,#1E1033 65%,#150B25);
  border:1px solid #A855F766;box-shadow:0 0 0 1px #7C3AED2e,0 14px 26px -16px #A855F7cc,inset 0 1px 0 #ffffff1f}
.pad-btn.big svg{width:26px;height:26px;color:#D9B9FF}
.pad-btn:active{transform:translateY(1px) scale(.97);background:#241540}
.pad-btn:disabled{opacity:.38}
.pad-btn.ready{animation:pulse 1.5s ease-in-out infinite}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 #A855F700}50%{box-shadow:0 0 0 6px #A855F71f}}
.pad-btn.cool{opacity:.5}

/* ================= OVERLAYS ================= */
.overlay{position:absolute;left:0;right:0;top:var(--ov-top,0px);bottom:var(--ov-bottom,0px);z-index:50;
  display:flex;flex-direction:column;align-items:center;
  gap:14px;padding:18px 16px 22px;overflow-y:auto;-webkit-overflow-scrolling:touch;
  background:radial-gradient(130% 78% at 50% -6%,#22103C 0%,#0C0616 46%,#050308 100%)}
.overlay::-webkit-scrollbar{width:0}

/* the dock + HUD stay above every menu, so pause / jump / ability
   can always be tapped (menus are inset between them) */
.overlay{z-index:50}
#hud,#controls{isolation:isolate}

.eyebrow{margin:0;font-size:11px;letter-spacing:.04em;color:#9F8FC4;text-align:center}
.display{font-family:'Amiri',serif;font-weight:700;margin:0;line-height:1.1;color:#F7F0DF;
  text-shadow:0 0 34px #A855F766,0 0 78px #7C3AED44}
.display.small{font-size:26px}
.latin{margin:2px 0 0;font-size:10px;letter-spacing:.42em;color:#8C6FC4;text-align:center;text-transform:uppercase}
.sub{margin:0;font-size:12.5px;line-height:1.6;color:#A79FC0;text-align:center;max-width:460px}

#scr-intro{justify-content:center}
.intro-head{display:flex;flex-direction:column;align-items:center;gap:4px;margin-top:4px}
#scr-intro h1{font-size:40px}
.cards{width:100%;max-width:600px;display:grid;grid-template-columns:1fr 1fr;gap:10px}
.card{position:relative;overflow:hidden;border-radius:16px;padding:13px 12px 14px;min-height:100px;
  display:flex;flex-direction:column;justify-content:flex-end;gap:3px;
  background:linear-gradient(160deg,#2A1249 0%,#180C2B 58%,#120A1E 100%);
  border:1px solid #7C3AED66;
  box-shadow:0 0 0 1px #A855F714,0 18px 34px -22px #7C3AEDcc,inset 0 0 46px -26px #A855F7}
.card .num{position:absolute;top:2px;left:12px;font-family:'Amiri',serif;font-size:44px;line-height:1;
  color:#A855F729;pointer-events:none}
.card h2{margin:0;font-family:'Amiri',serif;font-size:15px;font-weight:700;color:#EADCFB;line-height:1.25}
.card p{margin:0;font-size:11px;line-height:1.5;color:#9E90C0}
.card::after{content:"";position:absolute;inset:0;border-radius:16px;
  background:radial-gradient(80% 60% at 78% 8%,#A855F71f,transparent 60%);pointer-events:none}
.intro-foot{display:flex;flex-direction:column;align-items:center;gap:6px;margin-top:4px;width:100%;max-width:600px}

.btn-primary{position:relative;min-height:48px;padding:0 30px;border-radius:14px;font-size:15px;font-weight:700;
  color:#FBF6EA;background:linear-gradient(165deg,#8B4BF0,#6D28D9 62%,#4C1D95);
  border:1px solid #C4A0FF66;box-shadow:0 16px 34px -18px #A855F7,inset 0 1px 0 #ffffff33;
  transition:transform .1s ease,filter .15s ease}
.btn-primary:active{transform:translateY(1px) scale(.985);filter:brightness(1.08)}
.btn-primary:disabled{opacity:.5;box-shadow:none;filter:grayscale(.35)}
.btn-ghost{min-height:48px;padding:0 22px;border-radius:14px;font-size:14px;font-weight:600;color:#BDB4D4;
  background:#150C24;border:1px solid #ffffff1f}
.btn-ghost:active{background:#1F1233}

/* ---- brief ---- */
#scr-brief{justify-content:center}
.brief{width:100%;max-width:520px;display:flex;flex-direction:column;align-items:center;gap:12px}
.brief-bar{width:100%;height:3px;border-radius:99px;background:#ffffff12;overflow:hidden}
.brief-bar i{display:block;height:100%;width:0%;border-radius:99px;
  background:linear-gradient(90deg,#7C3AED,#A855F7,#E8C97A);transition:width .35s ease}
.brief-count{margin:0;font-size:11px;color:#8C82A8;font-variant-numeric:tabular-nums}
.brief-text{min-height:96px;margin:0;padding:16px 16px;border-radius:16px;width:100%;
  background:#0E0819;border:1px solid #7C3AED33;font-size:14.5px;line-height:1.85;color:#EDE7DA;text-align:center;
  box-shadow:inset 0 0 60px -34px #A855F7}

/* ---- character pick ---- */
#scr-pick{justify-content:flex-start;gap:12px}
.pick-head{display:flex;flex-direction:column;gap:6px;align-items:center}
.chars{width:100%;max-width:600px;display:grid;grid-template-columns:1fr 1fr;gap:9px}
.char-btn{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:3px;
  padding:11px 11px 12px;border-radius:15px;text-align:right;min-height:96px;
  background:linear-gradient(160deg,#180E29,#0F0819);border:1px solid #ffffff14;color:#D9D2E8;
  transition:transform .1s ease,border-color .18s,box-shadow .18s}
.char-btn .emblem{width:26px;height:26px;color:#A855F7;margin-bottom:2px}
.char-btn .emblem svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round}
.char-btn b{font-family:'Amiri',serif;font-size:15px;font-weight:700;color:#F0E9DA;line-height:1.1}
.char-btn small{font-size:10.5px;line-height:1.45;color:#948CAC}
.char-btn.sel{border-color:#A855F7aa;background:linear-gradient(160deg,#2A1249,#160B27);
  box-shadow:0 0 0 1px #A855F74d,0 16px 32px -22px #A855F7,inset 0 0 42px -26px #A855F7}
.char-btn.sel .emblem{color:#E8C97A}
.char-btn:active{transform:scale(.985)}

.secret-card{width:100%;max-width:600px;display:flex;flex-direction:column;gap:8px}
.secret-btn{display:flex;align-items:center;justify-content:center;gap:8px;min-height:46px;padding:0 14px;
  border-radius:13px;font-size:12.5px;font-weight:600;color:#BBA9DA;background:#120A1E;
  border:1px dashed #7C3AED59}
.secret-btn svg{width:16px;height:16px;stroke:currentColor;fill:none}
.secret-btn.armed{border-style:solid;border-color:#E8C97A88;color:#E8C97A}
.secret-text{margin:0;padding:12px 14px;border-radius:13px;font-size:12.5px;line-height:1.7;
  background:#0E0819;border:1px solid #E8C97A44;color:#EFE6D2;text-align:center}
.secret-text b{color:#E8C97A}

.pick-foot{width:100%;max-width:600px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.ready-count{display:flex;align-items:baseline;gap:3px;font-size:13px;color:#8C82A8}
.ready-count b{font-size:19px;color:#E8C97A;font-family:'Amiri',serif}
.ready-count em{font-style:normal;font-size:11px;margin-inline-start:5px;color:#8C82A8}

/* ---- round card ---- */
#scr-round,#scr-pause,#scr-end{justify-content:center}
.round-card,.end-card{width:100%;max-width:520px;display:flex;flex-direction:column;align-items:center;gap:12px;
  padding:22px 18px;border-radius:20px;background:linear-gradient(170deg,#150C24,#0A0614);
  border:1px solid #7C3AED3d;box-shadow:0 30px 70px -50px #A855F7,inset 0 0 80px -50px #A855F7}
.round-card .lines{display:flex;flex-direction:column;gap:6px;width:100%}
.round-card .lines p{margin:0;padding:9px 12px;border-radius:11px;background:#0E0819;border:1px solid #ffffff0f;
  font-size:12px;line-height:1.65;color:#B5ADCB;text-align:center}
.row-btns{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}

/* ---- end ---- */
.end-big{font-family:'Amiri',serif;font-size:38px;margin:0;color:#E8C97A;line-height:1;
  text-shadow:0 0 30px #E8C97A55}
.end-stats{display:flex;gap:10px;width:100%}
.end-stats div{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:9px 6px;border-radius:12px;
  background:#0E0819;border:1px solid #ffffff12}
.end-stats span{font-size:10.5px;color:#8C82A8}
.end-stats b{font-family:'Amiri',serif;font-size:19px;color:#EADCFB}

/* ---- small screens ---- */
@media (max-width:430px){
  #scr-intro h1{font-size:33px}
  .display.small{font-size:22px}
  .card{min-height:92px;padding:11px 10px 12px}
  .card h2{font-size:13.5px}
  .card p{font-size:10px}
  .card .num{font-size:36px;left:9px}
  .char-btn small{font-size:10px}
  .pad-btn.small{width:56px;height:52px}
  .pad-btn.big{width:74px;height:60px}
  .subtitle{font-size:12px;bottom:10px}
}
@media (max-height:420px){
  .hintbar{display:none}
  #joystick{width:92px;height:92px;left:12px;bottom:12px}
  #joy-knob{width:40px;height:40px;margin:-20px 0 0 -20px}
  .round-card,.end-card{padding:14px 14px;gap:8px}
  .end-big{font-size:28px}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001ms !important;transition-duration:.001ms !important}
}

/* ================= PRINT (unused but safe) ================= */
@media print{ body{background:#fff} #game-root{display:none} }