/* Mahjong Solitaire — mobile-first, donker, rustig */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #1d2b38 0%, #14202b 55%, #0e1720 100%);
  color: #f4efe6;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app { height: 100%; display: flex; flex-direction: column; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.hidden { display: none; }

button {
  font: inherit;
  color: inherit;
  background: #243647;
  border: 1px solid #35495d;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: scale(0.96); }
button.ghost { background: transparent; border-color: #3a4d60; }
button.primary { background: #e8b84b; color: #1a1408; border-color: #e8b84b; font-weight: 700; }

/* ---------- menu ---------- */
.menu-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 16px 12px;
  overflow-y: auto;
}
.logo { text-align: center; }
.logo .logo-tile {
  width: 64px; height: 64px;
  margin: 0 auto 10px;
  background: linear-gradient(145deg, #f7f1e4, #ddd3bd);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4), inset 0 1px 0 #fff;
  position: relative;
}
.logo .logo-tile::before, .logo .logo-tile::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: #b23a2e;
}
.logo .logo-tile::before { width: 14px; height: 14px; top: 13px; left: 25px; }
.logo .logo-tile::after  { width: 14px; height: 14px; bottom: 13px; right: 25px; }
.logo h1 { font-size: 26px; letter-spacing: .5px; }
.logo .tagline { color: #9fb0c0; font-size: 13px; margin-top: 4px; }

.layout-list { display: flex; flex-direction: column; gap: 10px; }
.layout-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #1c2b39;
  border: 1px solid #2c4053;
  border-radius: 16px;
  padding: 14px 16px;
}
.layout-card .thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 30% 40%, #e8b84b 0 12%, transparent 13%),
    radial-gradient(circle at 70% 40%, #e8b84b 0 12%, transparent 13%),
    radial-gradient(circle at 50% 70%, #e8b84b 0 12%, transparent 13%),
    linear-gradient(145deg, #f7f1e4, #d9cfb8);
  box-shadow: inset 0 1px 0 #fff, 0 3px 8px rgba(0,0,0,.35);
  flex: none;
}
.layout-card .meta { flex: 1; }
.layout-card .meta strong { display: block; font-size: 16px; }
.layout-card .meta small { color: #9fb0c0; }
.layout-card .best { color: #e8b84b; font-size: 12px; font-variant-numeric: tabular-nums; }

.menu-foot { display: flex; justify-content: center; gap: 10px; padding-bottom: 8px; }

/* ---------- spel ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(10, 17, 24, .55);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.hud-btn { width: 42px; height: 42px; padding: 0; border-radius: 10px; }
.hud-title { flex: 1; min-width: 0; }
.hud-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-sub { color: #9fb0c0; font-size: 12px; }
.hud-stats { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
#hud-score { color: #e8b84b; font-weight: 700; }
#hud-time { font-size: 15px; }

#board-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 17, 24, .55);
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.actions button { padding: 11px 4px; font-size: 13px; white-space: nowrap; }

/* ---------- winst ---------- */
.win-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px;
  text-align: center;
}
.win-inner h2 { font-size: 30px; }
.win-stats {
  background: #1c2b39;
  border: 1px solid #2c4053;
  border-radius: 18px;
  padding: 18px 26px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.win-row { display: flex; justify-content: space-between; gap: 30px; }
.win-row span { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.win-row label { color: #9fb0c0; align-self: center; }
.win-best { color: #e8b84b; font-weight: 700; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.win-btns { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); }
.win-btns .ghost { align-self: center; }