:root{
  --bg:#12161d;
  --felt:#16202b;
  --line:#2a3644;
  --ink:#e8eef6;
  --dim:#7f8f9f;
  --accent:#5aa9e6;
  --cw:70px;
  --ch:103px;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0}
body{
  background:var(--bg);
  color:var(--ink);
  font:14px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;
  overscroll-behavior:none;
  touch-action:manipulation;   /* no double-tap zoom on buttons and menus; the cards use touch-action:none */
  -webkit-user-select:none;user-select:none;
  display:flex;flex-direction:column;
  height:100dvh;
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom);
}

#bar{
  display:flex;align-items:center;gap:8px;
  padding:8px 12px;
  border-bottom:1px solid var(--line);
  background:#0e1218;
  flex:0 0 auto;
}
/* the title may carry a second, smaller line: the English original name */
#title{
  flex:1 1 0;min-width:0;text-align:center;
  font-weight:600;letter-spacing:.02em;font-size:13px;line-height:1.2;color:var(--ink);
  overflow-wrap:anywhere;
}
#title .en{display:block;font-weight:400;font-size:11px;color:var(--dim)}
#stat{color:var(--dim);font-size:12px;min-width:70px;text-align:right;white-space:nowrap}
button{
  font:inherit;color:var(--ink);background:#1b2430;border:1px solid var(--line);
  border-radius:8px;padding:6px 10px;cursor:pointer;
}
button:active{background:#243040}
.icon{width:38px;height:38px;padding:0;font-size:17px;line-height:1;border-radius:10px;flex:0 0 auto}
#btn-menu{font-size:15px}
#btn-help{font-size:18px;font-weight:700}

/* phone: the German title and the extra «?» button need the room */
@media (max-width:480px){
  #bar{gap:6px;padding:8px}
  #stat{min-width:0}
}

#board{
  position:relative;flex:1 1 auto;overflow:hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #1b2735 0%, var(--felt) 45%, #101820 100%);
}

.pile{position:absolute;width:var(--cw);height:var(--ch)}

.slot{
  position:absolute;inset:0;border-radius:6px;
  border:1px solid rgba(255,255,255,.09);
  background:rgba(255,255,255,.02);
}
.slot.fnd::after{
  content:attr(data-suit);position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  font-size:calc(var(--cw)*.42);color:rgba(255,255,255,.07);
}
.slot.stock{padding:0}
.slot.stock.empty::after{
  content:"\21BA";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  font-size:calc(var(--cw)*.4);color:rgba(255,255,255,.12);
}

.card{
  position:absolute;width:var(--cw);height:var(--ch);
  background-size:100% 100%;background-repeat:no-repeat;
  image-rendering:pixelated;
  border-radius:5px;
  box-shadow:0 1px 0 rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.35);
  transition:transform .09s ease-out, box-shadow .09s;
  will-change:transform;
  touch-action:none;   /* pointer-event drags must not scroll the board */
}
.card.sel{
  transform:translateY(-10px);
  box-shadow:0 0 0 2px var(--accent), 0 6px 14px rgba(0,0,0,.5);
}
.card.hint{box-shadow:0 0 0 2px rgba(90,169,230,.8)}
.card.drag{
  transition:none;   /* follow the pointer without lag */
  box-shadow:0 12px 28px rgba(0,0,0,.65) , 0 0 0 1px rgba(255,255,255,.15);
}

#menu,#won,#help{
  position:fixed;inset:0;background:rgba(8,11,15,.82);
  backdrop-filter:blur(6px);
  display:flex;align-items:center;justify-content:center;padding:20px;z-index:20;
}
#help{z-index:30}   /* above the menu, so closing it returns to where you were */
.hidden{display:none!important}
.sheet{
  background:#151c25;border:1px solid var(--line);border-radius:14px;
  padding:20px 20px 16px;max-width:520px;width:100%;max-height:88dvh;overflow:auto;
  box-shadow:0 20px 60px rgba(0,0,0,.6);
}
.sheet.small{max-width:320px;text-align:center}
.sheet h1{font-size:16px;margin:0 0 4px;letter-spacing:.04em}
.sheet .sub{color:var(--dim);font-size:12px;margin:0 0 14px}
.sheet .foot{color:#6b7c8d;font-size:11px;margin:14px 0 0;line-height:1.5}
.sheet code{color:#8498ab}
.sheet h2{font-size:14px;margin:18px 0 6px;letter-spacing:.02em;color:var(--accent)}

/* title row of the menu and help sheets: stays visible while the sheet scrolls
   (sticky offsets count from the padded edge, hence the -20px) */
.sheet-top{
  position:sticky;top:-20px;z-index:1;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin:-20px -20px 12px;padding:14px 20px 10px;
  background:#151c25;border-bottom:1px solid var(--line);border-radius:14px 14px 0 0;
}
.sheet-top h1{margin:0}
.sheet-top button{min-height:38px;padding:6px 14px;font-size:13px;flex:0 0 auto}

#game-list{list-style:none;margin:0;padding:0}
#game-list li{
  display:block;
  padding:9px 12px;border-radius:9px;cursor:pointer;border:1px solid transparent;
}
#game-list li:hover{background:#1b2430}
#game-list li.active{background:#1b2430;border-color:#2f4a63}
#game-list .n{display:block;font-size:13px;overflow-wrap:anywhere}
#game-list .d{display:block;margin-top:2px;color:var(--dim);font-size:11px;line-height:1.4}
#game-list .sec{
  padding:14px 12px 6px;color:#55677a;font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  cursor:default;
}
.sheet .sec{
  padding:14px 12px 6px;color:#8697a8;font-size:12px;letter-spacing:.04em;
  cursor:default;margin:0;
}
.settings{margin-top:14px;border-top:1px solid var(--line)}
.settings .sec{padding-top:4px}
#back-picker{
  display:grid;grid-template-columns:repeat(8,1fr);gap:10px;padding:0 12px 4px;
}
@media (max-width:480px){
  #back-picker{grid-template-columns:repeat(4,1fr);row-gap:12px}
}
#back-picker .back{
  width:36px;height:53px;justify-self:center;padding:0;
  background-size:100% 100%;background-repeat:no-repeat;image-rendering:pixelated;
  border:2px solid transparent;border-radius:5px;
}
#back-picker .back.active{border-color:var(--accent);box-shadow:0 0 0 1px rgba(90,169,230,.4)}
button.primary{
  background:#1d3a52;border-color:#2f5c80;padding:10px 18px;margin-top:8px;
}

/* Hilfe: long German prose reads better in a proportional face */
.how{margin:0;padding-left:20px}
.how li,#help-rules p{
  font:15px/1.6 -apple-system,system-ui,"Helvetica Neue",Arial,sans-serif;
}
.how li{margin:0 0 7px}
#help-games{display:flex;flex-wrap:wrap;gap:6px}
#help-games button{min-height:38px;padding:6px 10px;font-size:13px}
#help-games button.active{background:#1d3a52;border-color:#2f5c80}
#help-rules h3{font-size:15px;margin:16px 0 0;letter-spacing:.02em}
#help-rules h4{
  margin:12px 0 2px;color:#8697a8;font-size:12px;letter-spacing:.04em;
}
#help-rules p{margin:0}
.sheet.help{max-width:600px}
