/* ==========================================================================
   Pengasmart Core – gemensam design för alla Pengasmart-spel
   Mörk bakgrund, guld och mint. Importeras av varje spel.
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg0: #03120d;
  --bg1: #052419;
  --deep: #063b2a;
  --mid: #087443;
  --mint: #0b9b5a;
  --mint-hi: #46e0a0;
  --gold: #ffc130;
  --gold-hi: #ffe08a;
  --gold-lo: #b9811a;
  --ink: #edf1fb;
  --muted: #b9d9c8;
  --red: #ff5d73;
  --orange: #ff8a3d;
  --purple: #9d86ff;
  --blue: #67b7ff;
  --cyan: #3dd5e0;
  --pink: #ff9ad5;
  --panel: rgba(6, 32, 24, 0.94);
  --line: rgba(255, 193, 48, 0.45);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg0); overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(11, 155, 90, 0.28), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(255, 193, 48, 0.09), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

/* ---------- Layout: mobilkolumn som även fungerar på dator ---------- */
.ps-app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  width: min(100%, 540px);
  margin: 0 auto;
  height: 100dvh;
  overflow: hidden;
}
@media (min-width: 700px) {
  .ps-app {
    top: 12px; bottom: 12px; height: auto;
    border: 1px solid rgba(255, 193, 48, 0.28);
    border-radius: 28px;
    background: rgba(3, 18, 13, 0.55);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(11, 155, 90, 0.18) inset;
    backdrop-filter: blur(2px);
  }
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- Knappar ---------- */
.ps-btn {
  appearance: none; border: 2px solid var(--gold);
  background: linear-gradient(#14b36e, var(--mid));
  color: #fff; font-weight: 800; letter-spacing: 0.01em;
  min-height: 54px; padding: 0 20px; border-radius: 16px;
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 6px 0 #04261b, 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.ps-btn:hover { filter: brightness(1.08); }
.ps-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #04261b, 0 4px 10px rgba(0, 0, 0, 0.35); }
.ps-btn.gold { background: linear-gradient(var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #3b2a00; border-color: #fff2c4; box-shadow: 0 6px 0 #6b4a05, 0 10px 24px rgba(0, 0, 0, 0.35); }
.ps-btn.gold:active { box-shadow: 0 2px 0 #6b4a05, 0 4px 10px rgba(0, 0, 0, 0.35); }
.ps-btn.ghost { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(237, 241, 251, 0.35); box-shadow: none; font-weight: 700; min-height: 48px; }
.ps-btn.ghost:active { transform: scale(0.97); }
.ps-btn.small { min-height: 42px; font-size: 15px; padding: 0 14px; border-radius: 12px; }
.ps-btn.icon { min-width: 44px; padding: 0 10px; }
.ps-btn:disabled { filter: grayscale(0.7) brightness(0.7); }

/* ---------- Paneler ---------- */
.ps-panel {
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
}
.ps-brand { letter-spacing: 0.28em; font-size: 12px; color: #8ee0b4; font-weight: 700; }
.ps-title {
  font-size: clamp(30px, 9vw, 48px); font-weight: 900; letter-spacing: 0.04em; color: var(--gold);
  background: linear-gradient(100deg, var(--gold) 30%, #fff3c9 48%, var(--gold) 66%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: ps-shimmer 5s linear infinite;
  filter: drop-shadow(0 4px 0 #04261b);
}
.ps-muted { color: var(--muted); }
.ps-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 13px; font-weight: 800;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14);
}
.ps-chip.gain { color: var(--gold-hi); border-color: rgba(255, 193, 48, 0.55); background: rgba(255, 193, 48, 0.12); }
.ps-chip.loss { color: #ff9aa8; border-color: rgba(255, 93, 115, 0.55); background: rgba(255, 93, 115, 0.12); }
.ps-chip.mint { color: var(--mint-hi); border-color: rgba(70, 224, 160, 0.5); background: rgba(11, 155, 90, 0.16); }

/* ---------- Bottom sheet ---------- */
.ps-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 8, 5, 0.62);
  display: flex; align-items: flex-end; justify-content: center;
  animation: ps-fade 0.2s ease both;
}
.ps-sheet {
  width: min(100%, 540px); max-height: 88dvh; overflow: auto;
  background: var(--panel); border: 2px solid var(--gold); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 18px 18px calc(18px + var(--safe-bottom));
  animation: ps-slide-up 0.28s cubic-bezier(.2, .9, .3, 1) both;
}
.ps-sheet h2 { font-size: 22px; color: var(--gold); margin-bottom: 10px; }
.ps-sheet .ps-grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, 0.25); margin: -6px auto 12px; }

/* ---------- Toast ---------- */
.ps-toasts { position: fixed; z-index: 70; left: 0; right: 0; bottom: calc(14px + var(--safe-bottom)); display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; }
.ps-toast {
  background: var(--gold); color: #3b2a00; font-weight: 800; padding: 9px 16px; border-radius: 999px;
  max-width: calc(100% - 24px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: ps-toast 3.2s ease both; display: flex; gap: 8px; align-items: center;
}
.ps-toast.badge { background: linear-gradient(var(--gold-hi), var(--gold)); border: 2px solid #fff2c4; }
.ps-toast .ico { font-size: 22px; }

/* ---------- Flytande tal ---------- */
.ps-float {
  position: fixed; z-index: 65; pointer-events: none; font-weight: 900; font-size: 22px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); animation: ps-floatup 1.3s ease-out both; white-space: nowrap;
}
.ps-float.gain { color: var(--gold-hi); }
.ps-float.loss { color: #ff8d9c; }

/* ---------- Reglage ---------- */
.ps-switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-weight: 700; }
.ps-switch input { appearance: none; width: 54px; height: 32px; border-radius: 99px; background: #26413a; position: relative; transition: background 0.2s; flex: none; }
.ps-switch input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.ps-switch input:checked { background: var(--mint); }
.ps-switch input:checked::after { transform: translateX(22px); }

/* ---------- Progressbar ---------- */
.ps-bar { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.45); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
.ps-bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--mint-hi)); transition: width 0.6s cubic-bezier(.2, .9, .3, 1); }
.ps-bar.gold > i { background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); }

/* ---------- Animationer ---------- */
@keyframes ps-shimmer { to { background-position: -220% 0; } }
@keyframes ps-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ps-slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ps-toast { 0% { opacity: 0; transform: translateY(14px) scale(0.9); } 8%, 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(10px); } }
@keyframes ps-floatup { 0% { opacity: 0; transform: translate(-50%, 6px) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -64px) scale(1); } }
@keyframes ps-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes ps-pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes ps-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.ps-shake { animation: ps-shake 0.38s ease; }
.ps-popin { animation: ps-pop 0.45s cubic-bezier(.2, .9, .3, 1.2) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .ps-title { animation: none; }
}
