*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;overflow:hidden}
body{font-family:system-ui,-apple-system,"Segoe UI","Noto Sans Arabic","Geeza Pro",Tahoma,Arial,sans-serif;background:#e9f1f6;color:#1b2a36;font-size:15px;line-height:1.45;user-select:none;-webkit-user-select:none;touch-action:manipulation}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
button:focus-visible,[tabindex]:focus-visible{outline:3px solid #f08c00;outline-offset:2px}
#app{height:100%;display:flex;flex-direction:column}
#top{display:flex;align-items:center;gap:.6em;padding:.35em .7em;background:#15405e;color:#fff}
#top .ttl{font-weight:700;white-space:nowrap}
#prog{flex:1;display:flex;gap:4px;justify-content:center}
#prog i{width:.7em;height:.7em;border-radius:50%;background:#4d6f88}
#prog i.cur{background:#ffd43b;transform:scale(1.25)}
#prog i.ok{background:#51cf66}
#prog i.skip{background:#adb5bd}
#stars{font-weight:700;color:#ffd43b;white-space:nowrap;direction:ltr}
#tabs{display:flex;background:#d5e2ec}
#tabs button{flex:1;padding:.5em .2em;font-weight:700;color:#456;border-bottom:3px solid transparent;min-height:40px}
#tabs button.on{background:#fff;color:#15405e;border-bottom-color:#f08c00}
#lab{flex:1 1 0;min-height:0;display:flex}
.station{flex:1 1 0;min-width:0;min-height:0;display:none;flex-direction:column;background:#fff;margin:6px;border-radius:14px;padding:4px 6px 6px;box-shadow:0 1px 3px rgba(0,0,0,.12)}
.station.on{display:flex}
.station svg{flex:1 1 0;min-height:0;width:100%;height:100%;direction:ltr;touch-action:none;display:block}
.ctl{display:flex;gap:5px;justify-content:center;direction:ltr}
#crow{direction:rtl}
.ctl button{flex:1;min-height:42px;border-radius:10px;background:#f1e2b6;border:2px solid #c9a03f;font-weight:700;max-width:9em}
.ctl button.alt{background:#e7edf2;border-color:#9fb2c1;font-size:.82em}
#crow button{background:#d9eefc;border-color:#69b9f0}
.ctl button:active{transform:scale(.94)}
#tray{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;padding:0 6px 6px}
.ti{display:flex;flex-direction:column;align-items:center;justify-content:center;background:#fff;border:2px solid #c5d3de;border-radius:12px;min-height:50px;padding:1px;touch-action:none;position:relative}
.ti svg{width:34px;height:34px;pointer-events:none;direction:ltr}
.ti span{font-size:.7em;line-height:1.1;font-weight:600;pointer-events:none}
.ti.sel{border-color:#f08c00;background:#fff4e0;box-shadow:0 0 0 3px rgba(240,140,0,.3)}
.ti.away{opacity:.4;border-style:dashed}
.ti.tool{background:#fff0e6;border-color:#e8743b}
.ti .big{font-size:1.4em;line-height:1.2}
#panel{background:#fff;border-top:2px solid #c5d3de;padding:.5em .7em .6em;max-height:48%;overflow-y:auto}
.qh{display:flex;justify-content:space-between;align-items:center;font-size:.85em;color:#15405e}
.qh .tool{background:#e3eef6;border-radius:99px;padding:0 .7em}
.q{font-size:1.02em;margin:.2em 0 .3em}
.fb{border-radius:10px;padding:.35em .6em;margin:.25em 0;font-size:.93em}
.fb.no{background:#fff1e0;border:1.5px solid #f0a040}
.fb.ok{background:#e3f8e8;border:1.5px solid #40a860}
.fb.hint{background:#eef3ff;border:1.5px solid #6c8cd5}
.fields{display:flex;gap:6px;margin:.3em 0}
.fld{flex:1;border:2px solid #c5d3de;border-radius:10px;padding:.15em .3em;min-height:46px;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#f8fbfd}
.fld small{font-size:.7em;line-height:1.15;color:#567}
.fld .v{direction:ltr;font-weight:700;font-size:1.15em;white-space:nowrap}
.fld .v b{display:inline-block;min-width:1.6em;border-bottom:2px solid #9fb2c1;text-align:center}
.fld.on{border-color:#1c7ed6;background:#e7f3ff}
.keys{display:grid;grid-template-columns:repeat(11,1fr);gap:3px;direction:ltr;margin:.3em 0}
.keys button{min-height:44px;border-radius:8px;background:#eef2f5;border:1.5px solid #c5d3de;font-weight:700;font-size:1.1em}
.keys button:active,.choices button:active,.acts button:active{transform:scale(.94)}
.choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(6.2em,1fr));gap:6px;margin:.4em 0}
.choices button{min-height:52px;border-radius:12px;background:#f8fbfd;border:2px solid #9fb2c1;font-weight:700;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:.2em .3em}
.choices button svg{width:36px;height:36px;direction:ltr}
.choices button.bad{opacity:.45;border-style:dashed}
.acts{display:flex;gap:6px;margin-top:.3em}
.acts button{flex:1;min-height:46px;border-radius:12px;font-weight:700;background:#e7edf2;border:2px solid #9fb2c1}
.acts .pri{background:#1c7ed6;border-color:#1864ab;color:#fff;flex:2}
.acts .hintb{background:#fff8db;border-color:#f0c040}
#toast{position:fixed;top:12%;left:50%;transform:translateX(-50%);background:#243746;color:#fff;padding:.6em 1em;border-radius:12px;max-width:88vw;text-align:center;opacity:0;pointer-events:none;transition:opacity .2s;z-index:30;font-weight:600}
#toast.on{opacity:.96}
#overlay{position:fixed;inset:0;top:0;left:0;right:0;bottom:0;background:rgba(21,64,94,.93);display:none;align-items:center;justify-content:center;padding:14px;z-index:40;overflow-y:auto}
#overlay.on{display:flex}
.card{background:#fff;border-radius:18px;padding:1.1em 1.2em;max-width:34em;width:100%;max-height:100%;overflow-y:auto}
.card h1{font-size:1.4em;color:#15405e;text-align:center;margin-bottom:.4em}
.card ol,.card ul{padding-inline-start:1.3em;margin:.5em 0}
.card li{margin:.35em 0}
.card .go{display:block;width:100%;min-height:54px;margin-top:.8em;border-radius:14px;background:#1c7ed6;color:#fff;font-weight:700;font-size:1.15em}
.card .score{text-align:center;font-size:1.6em;color:#e69500;font-weight:700;direction:ltr}
.card .sub{text-align:center;color:#456;margin-bottom:.3em}
.ghost{position:fixed;left:0;top:0;width:64px;height:64px;margin:-32px 0 0 -32px;pointer-events:none;z-index:50;opacity:.9;direction:ltr}
.has-sel .dish{stroke:#f08c00;stroke-width:4;stroke-dasharray:7 5}
.has-sel .glass{stroke:#f08c00;stroke-dasharray:7 5}
.o,.wchip,[data-drop]{cursor:pointer}
@media (min-width:900px){
  body{font-size:clamp(16px,1.2vw,26px)}
  #app{display:grid;grid-template-columns:1fr minmax(340px,30vw);grid-template-rows:auto 1fr auto}
  #top{grid-column:1/-1}
  #tabs{display:none}
  #lab{grid-column:1;grid-row:2}
  .station{display:flex}
  #st-bal{flex:1.25 1 0}
  #tray{grid-column:1;grid-row:3;grid-template-columns:repeat(8,1fr);padding:0 6px 8px}
  .ti{min-height:4.6em}.ti svg{width:2.8em;height:2.8em}
  #panel{grid-column:2;grid-row:2/4;border-top:0;border-inline-start:2px solid #c5d3de;max-height:none;padding:1em}
  .keys{grid-template-columns:repeat(4,1fr);gap:6px}.keys button{min-height:2.8em}
  .ctl button{min-height:2.8em}
  .choices button{min-height:3.6em}
}
