/* TIPS Royale v30.8.27 - extended statistics on the final scorecard (additive; loads last).
   The button sits under "Til hovedmenu"; the panel is its own dialog above the scorecard. */
.game-end-actions-final .game-stats-open{
  width:min(280px,100%)!important;
  border:1px solid #6d5a2a!important;
  background:linear-gradient(180deg,#1b2c3f,#122234)!important;
  color:#f1dc9a!important;
  font-weight:900!important;
  touch-action:manipulation;
}
.game-end-actions-final .game-stats-open.hidden{display:none!important}

.game-stats-overlay{
  position:fixed;inset:0;z-index:12500;
  display:grid;place-items:center;
  padding:max(10px,env(safe-area-inset-top)) 10px max(10px,env(safe-area-inset-bottom));
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(5px);
  pointer-events:auto;
}
.game-stats-overlay.hidden{display:none!important}
.game-stats-card{
  display:flex;flex-direction:column;
  width:min(560px,96vw);
  max-height:min(94dvh,860px);
  padding:14px;
  border:1px solid #aa8734;
  border-radius:16px;
  background:#0b1b2b;
  box-shadow:0 24px 80px rgba(0,0,0,.6);
  color:#e8f0f7;
  text-align:left;
}
.game-stats-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:10px;
  padding-bottom:8px;border-bottom:1px solid rgba(255,255,255,.08);
}
.game-stats-title{margin:3px 0 0;font-size:17px;font-weight:1000;letter-spacing:.6px;color:#ffe591}
.game-stats-sub{margin-top:2px;font-size:11px;color:#9db2c7}
.game-stats-x{
  flex:0 0 auto;width:34px;height:34px;border-radius:50%;
  border:1px solid #315472;background:#081827;color:#d9e8f5;font-size:15px;cursor:pointer;
}
.game-stats-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:10px 1px 4px;-webkit-overflow-scrolling:touch}
.game-stats-actions{display:grid;justify-items:center;padding-top:9px;border-top:1px solid rgba(255,255,255,.08)}
.game-stats-actions .btn{width:min(280px,100%)}

.gs-awards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-bottom:12px}
.gs-award{
  display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-areas:"icon label" "icon name" "icon value";
  column-gap:8px;align-items:center;
  padding:8px 9px;border:1px solid #2a4560;border-radius:10px;background:#091b2b;
}
.gs-award-icon{grid-area:icon;font-size:22px;line-height:1}
.gs-award-label{grid-area:label;font-size:9px;font-weight:900;letter-spacing:.4px;color:#d9bd68;text-transform:uppercase}
.gs-award-name{grid-area:name;min-width:0;font-size:14px;line-height:1.2;color:#fff;overflow-wrap:anywhere}
.gs-award-value{grid-area:value;font-size:11px;color:#9db2c7}
.gs-suit{display:inline-block;min-width:1em;text-align:center;font-weight:1000}
.game-stats-card .gs-suit.red{color:#ff6b6b!important}
.game-stats-card .gs-suit.black{color:#e8f0f7!important}

.gs-bars{display:grid;gap:5px;margin-bottom:6px}
.gs-bar-row{display:grid;grid-template-columns:20px 62px minmax(0,1fr) 26px;gap:7px;align-items:center;font-size:12px}
.gs-bar-row .gs-suit{font-size:16px}
.gs-bar{height:10px;border-radius:999px;background:#13283b;overflow:hidden}
.gs-bar>span{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#9e7c2f,#f0cf6a)}
.gs-bar-count{text-align:right;font-weight:900}

.gs-table{width:100%;border-collapse:collapse;margin:2px 0 6px;font-size:12px}
.gs-table th,.gs-table td{padding:6px 4px;border-bottom:1px solid rgba(255,255,255,.07);text-align:center}
.gs-table thead th{font-size:9px;font-weight:900;letter-spacing:.3px;color:#9db2c7;text-transform:uppercase}
.gs-table thead th:first-child,.gs-table tbody th{text-align:left}
.gs-table tbody th{max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:900}
.gs-table td.lead{color:#ffe591;font-weight:1000}
.gs-note,.gs-legend,.gs-empty{margin:4px 0;font-size:10px;line-height:1.4;color:#9db2c7}

@media (max-width:380px){
  .game-stats-card{padding:10px}
  .gs-awards{gap:5px}
  .gs-award{padding:6px 7px;column-gap:6px}
  .gs-award-icon{font-size:18px}
  .gs-award-name{font-size:12px}
  .gs-table{font-size:11px}
  .gs-table th,.gs-table td{padding:5px 2px}
  .gs-table thead th{font-size:8px}
}
@media (max-height:520px) and (orientation:landscape){
  .game-stats-card{max-height:96dvh;padding:9px}
  .gs-awards{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* Short screens (phone held sideways, 5 players): the scorecard has no room for a second
   full-width button, so the two buttons share one row, and the card may scroll as a last resort. */
@media (max-height:520px){
  #gameEndOverlay .game-end-actions-final{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    justify-items:stretch!important;
    gap:6px!important;
  }
  #gameEndOverlay .game-end-actions-final .btn{width:100%!important}
  #gameEndOverlay .game-end-card{overflow:auto!important}
}
