/* ===== SPLASH SCREEN ===== */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splashFadeIn 0.5s ease forwards;
}

#splash-screen.splash-hiding {
  animation: splashFadeOut 0.7s var(--ease-out-expo) forwards;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.splash-book {
  width: 280px;
  max-width: 80vw;
  filter: drop-shadow(0 0 40px rgba(212, 175, 55, 0.5)) drop-shadow(0 16px 32px rgba(0,0,0,0.7));
  animation: splashBookFloat 0.6s var(--spring) 0.1s both;
}

.splash-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #b8922a 0%, #f5e070 30%, #d4af37 50%, #f5e070 70%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% auto;
  animation: splashTitleFade 0.6s var(--ease-out-expo) 0.35s both, shimmer 4s ease-in-out 1s infinite;
}

@keyframes splashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes splashFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

@keyframes splashBookFloat {
  0%   { opacity: 0; transform: translateY(16px) scale(0.92); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes splashTitleFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #1a1a1a;
  --bg-2: #242424;
  --bg-3: #2e2e2e;
  --gold: #d4af37;
  --gold-light: #e8c84a;
  --gold-dim: rgba(212, 175, 55, 0.15);
  --text: #f0f0f0;
  --text-muted: #888;
  --danger: #e05252;
  --success: #4caf82;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
  --header-height: 56px;
  --transition: 0.2s ease;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  padding: 0;
}

/* ===== APP SHELL ===== */
#app {
  position: fixed;
  inset: 0;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  position: absolute;
  inset: 0;
}

.screen.active {
  display: flex;
  animation: screenEnter 0.32s var(--ease-out-expo) both;
}

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 0 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
  padding-bottom: 8px;
  background: rgba(28, 28, 28, 0.92);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  flex-shrink: 0;
}

.app-header-centered {
  justify-content: center;
}

.header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #b8922a 0%, #f5e070 30%, #d4af37 50%, #f5e070 70%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% auto;
  animation: shimmer 4s ease-in-out infinite;
}

/* Gruppnamn i dashboard-headern – varm amber-ton, skiljer sig från app-titeln */
.header-title.header-title-group {
  background: linear-gradient(90deg, #e8a020 0%, #f5c842 40%, #e09018 70%, #f5c842 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  background-size: 200% auto;
  font-style: normal;
  letter-spacing: 1px;
  animation: shimmer 5s ease-in-out infinite;
  color: transparent;
}

/* ===== LOBBY BOOK IMAGE ===== */
.lobby-book-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: -8px;
}

.lobby-book-wrap::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 60px;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(212,175,55,0.35) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(8px);
}

.lobby-book-img {
  display: block;
  width: 220px;
  max-width: 70vw;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: lobbyBookEnter 0.8s var(--spring) 0.05s forwards;
}

@keyframes lobbyBookEnter {
  0%   { opacity: 0; transform: translateY(14px) scale(0.93); }
  65%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== LOBBY ===== */
#screen-lobby {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(212,175,55,0.07) 0%, transparent 70%),
    var(--bg);
}

.lobby-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.logo {
  text-align: center;
}

.logo-icon {
  font-size: 56px;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 10px;
  text-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
  display: inline-block;
  opacity: 0;
  animation: logoIconDrop 0.7s var(--spring) 0.1s forwards;
}

@keyframes logoIconDrop {
  0%   { opacity: 0; transform: translateY(-20px) scale(0.8); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.logo h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 3px;
  background: linear-gradient(90deg, #b8922a 0%, #f5e070 30%, #d4af37 50%, #f5e070 70%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% auto;
  animation: shimmer 4s ease-in-out infinite, logoTitleFade 0.6s var(--ease-out-expo) 0.25s both;
  margin-bottom: 0;
}

@keyframes logoTitleFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  50% { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.logo-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px auto 10px;
  width: 80%;
  opacity: 0;
  animation: fade-in 0.8s ease 0.4s forwards;
}

.logo-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(212,175,55,0.5), transparent);
}

.logo-divider-diamond {
  color: var(--gold);
  font-size: 7px;
  opacity: 0.7;
}

.logo-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  color: rgba(212, 175, 55, 0.55);
  font-size: 15px;
  letter-spacing: 5px;
  text-transform: uppercase;
  opacity: 0;
  animation: fade-in 0.8s ease 0.6s forwards;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  animation: cardSlideUp 0.55s var(--ease-out-expo) 0.5s both;
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
}

/* ===== FORM ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"] {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  touch-action: manipulation;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

input[type="number"] {
  -moz-appearance: textfield;
}

select.input-select {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

select.input-select:focus {
  border-color: var(--gold);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

/* ===== BUTTONS ===== */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s var(--spring), box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Ripple-animation */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.25) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.4s ease, opacity 0.4s ease;
  border-radius: inherit;
}

.btn:active::after {
  transform: scale(2.5);
  opacity: 1;
  transition: transform 0s, opacity 0s;
}

.btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37 0%, #e8c84a 50%, #c9a227 100%);
  color: #1a1a1a;
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e8c84a 0%, #f5e070 50%, #d4af37 100%);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.45);
}

.btn-primary:active {
  box-shadow: 0 1px 6px rgba(212, 175, 55, 0.2);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid #3a3a3a;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.35);
  letter-spacing: 0.03em;
  transition: background 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.btn-ghost:active {
  background: rgba(212, 175, 55, 0.12);
}

.btn-full {
  width: 100%;
}

.modal-overlay--center {
  align-items: center;
  justify-content: center;
}

.modal-close-book {
  text-align: center;
  padding: 32px 24px 28px;
  max-width: 340px;
  width: calc(100% - 40px);
  border-radius: 20px;
}

.close-book-icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.close-book-title {
  font-size: 20px;
  color: var(--gold);
  margin: 0 0 10px;
}

.close-book-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.close-book-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
  transition: color 0.2s ease, transform 0.15s var(--spring);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
  color: var(--gold);
}

.btn-icon:active {
  transform: scale(0.88);
  color: var(--gold);
}

.btn-icon-danger:hover {
  color: var(--danger) !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ===== DIVIDER ===== */
.divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #3a3a3a;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* ===== SECTIONS ===== */
.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.btn-unit-toggle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}

.btn-unit-toggle:hover {
  background: var(--gold);
  color: #1a1a2e;
}

/* ===== BALANCES ===== */
.balances-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  opacity: 0;
  transform: translateX(-12px);
  animation: balanceItemIn 0.4s var(--ease-out-expo) both;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.balance-item:active {
  transform: scale(0.99);
}

/* Stagger delay per item (handled via JS nth-child fallback or inline style if needed) */
.balance-item:nth-child(1) { animation-delay: 0.05s; }
.balance-item:nth-child(2) { animation-delay: 0.10s; }
.balance-item:nth-child(3) { animation-delay: 0.15s; }
.balance-item:nth-child(4) { animation-delay: 0.20s; }
.balance-item:nth-child(5) { animation-delay: 0.25s; }
.balance-item:nth-child(6) { animation-delay: 0.30s; }

@keyframes balanceItemIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.balance-item.positive {
  border-color: rgba(76, 175, 130, 0.25);
}

.balance-item.negative {
  border-color: rgba(224, 82, 82, 0.25);
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.2s var(--spring);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.balance-item:active .player-avatar {
  transform: scale(0.9);
}

.balance-info {
  flex: 1;
}

.balance-name {
  font-weight: 600;
  font-size: 15px;
}

.balance-you {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 6px;
}

.balance-amount {
  font-size: 17px;
  font-weight: 700;
}

.balance-amount.positive { color: var(--success); }
.balance-amount.negative { color: var(--danger); }
.balance-amount.zero { color: var(--text-muted); }

/* ===== SETTLEMENT TOGGLE ===== */
.settlement-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text);
  text-align: left;
}

.settlement-toggle:hover {
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.05);
}

.settlement-toggle[aria-expanded="true"] {
  border-color: var(--gold);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.settlement-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-label {
  color: var(--gold);
}

.settlement-toggle-icon {
  font-size: 15px;
  opacity: 0.7;
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-icon {
  opacity: 1;
}

.settlement-toggle-badge {
  background: var(--gold);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  border-radius: 10px;
  padding: 2px 8px;
  line-height: 1.4;
  display: none;
}

.settlement-toggle-badge.visible {
  display: inline-block;
}

.settlement-toggle-chevron {
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  transition: transform 0.3s var(--spring), color 0.2s ease;
  transform: rotate(0deg);
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-chevron {
  transform: rotate(90deg);
  color: var(--gold);
}

.settlements-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  opacity: 0;
  background: var(--bg-2);
  border: 1px solid var(--gold);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.settlements-panel.open {
  max-height: 600px;
  opacity: 1;
}

.settlements-panel .settlements-list {
  padding: 12px;
}

/* ===== SETTLEMENTS ===== */
.settlements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== TOTALS ===== */
.totals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

.totals-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.totals-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.totals-amount {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.totals-amount.positive { color: var(--success); }
.totals-amount.negative { color: var(--danger); }
.totals-amount.zero { color: var(--text-muted); }

.settlement-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.settlement-from { color: var(--danger); font-weight: 600; }
.settlement-arrow { color: var(--text-muted); }
.settlement-to { color: var(--success); font-weight: 600; }
.settlement-amount { margin-left: auto; font-weight: 700; color: var(--gold); }

.btn-confirm-tx {
  background: none;
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.2s ease, transform 0.15s var(--spring), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-confirm-tx:hover {
  background: rgba(76, 175, 130, 0.15);
  box-shadow: 0 0 0 4px rgba(76, 175, 130, 0.1);
}

.btn-confirm-tx:active {
  transform: scale(0.88);
  background: rgba(76, 175, 130, 0.25);
}

.settlement-confirmed {
  opacity: 0.6;
}

.confirmed-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.btn-unconfirm-tx {
  background: none;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: all var(--transition);
}

.btn-unconfirm-tx:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== ACTIVE SESSION PREVIEW ===== */
.active-session-preview {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--gold-dim);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.active-session-preview:hover {
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.06);
}

.active-session-preview:active {
  transform: scale(0.99);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.04);
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8c84a 0%, #d4af37 50%, #b89428 100%);
  color: #1a1a1a;
  border: none;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(212, 175, 55, 0.45),
    0 0 0 0 rgba(212, 175, 55, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
  z-index: 100;
  -webkit-tap-highlight-color: transparent;
  animation: fabPulse 3s ease-in-out 1.5s infinite;
}

@keyframes fabPulse {
  0%   { box-shadow: 0 4px 20px rgba(212,175,55,0.45), 0 0 0 0 rgba(212,175,55,0.35); }
  60%  { box-shadow: 0 4px 20px rgba(212,175,55,0.45), 0 0 0 14px rgba(212,175,55,0); }
  100% { box-shadow: 0 4px 20px rgba(212,175,55,0.45), 0 0 0 0 rgba(212,175,55,0); }
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(212, 175, 55, 0.6);
}

.fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
  animation: none;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(28, 28, 28, 0.95);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  display: flex;
  align-items: stretch;
  z-index: 200;
}

.bottom-nav.hidden { display: none; }

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color 0.2s ease;
  padding: 8px 4px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

/* Active pill indicator */
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) scaleX(1);
  width: 28px;
  height: 3px;
  background: var(--gold);
  border-radius: 0 0 3px 3px;
  animation: navPillIn 0.3s var(--spring) both;
}

@keyframes navPillIn {
  from { width: 0; opacity: 0; }
  to   { width: 28px; opacity: 1; }
}

.nav-btn.active {
  color: var(--gold);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.25s var(--spring);
}

.nav-btn.active .nav-icon {
  transform: scale(1.15) translateY(-1px);
}

.nav-btn:active .nav-icon {
  transform: scale(0.88);
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.nav-btn:not(.active) .nav-label {
  opacity: 0.7;
}

/* ===== SESSION MODES ===== */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.mode-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.mode-tab.active {
  background: var(--gold);
  color: #1a1a1a;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

/* ===== QUICK MODE ===== */
.quick-players-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

/* ===== QUICK PLAYER ROW (fler spelare) ===== */
.quick-player-row {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.quick-player-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
}


.amount-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #3a3a3a;
  background: var(--bg-3);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, transform 0.12s var(--spring), background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.amount-btn:active {
  border-color: var(--gold);
  transform: scale(0.88);
  background: rgba(212, 175, 55, 0.1);
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-player-row .player-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.btn-sign-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #3a3a3a;
  background: var(--bg-3);
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, transform 0.12s var(--spring), background 0.15s ease;
  line-height: 1;
  padding: 0;
  /* Utökad touch-yta utan att synas större */
  touch-action: manipulation;
  position: relative;
}
.btn-sign-toggle::after {
  content: '';
  position: absolute;
  inset: -8px;
}

.btn-sign-toggle:active {
  transform: scale(0.88);
}

.btn-sign-toggle.is-negative {
  color: #ff5555;
  border-color: #ff5555;
  background: rgba(255, 85, 85, 0.12);
}

.btn-sign-toggle.is-negative:active {
  background: rgba(255, 85, 85, 0.25);
}

.amount-input {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  text-align: center;
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 3px 4px;
  height: 34px;
}

.amount-input:focus {
  border-color: var(--gold);
  outline: none;
}

.notepad-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.btn-unit-toggle-inline {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 60px + 8px);
  right: 26px;
  z-index: 150;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: var(--gold);
  color: #1a1a2e;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}

.btn-unit-toggle-inline:active {
  opacity: 0.8;
}

.btn-unit-toggle-inline:active {
  opacity: 0.8;
}

.unit-coin-label {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: normal;
  color: inherit;
  letter-spacing: inherit;
  transition: none;
  user-select: none;
  pointer-events: none;
}

.btn-unit-toggle-inline.flipping .unit-coin-label {
  animation: coin-flip 0.25s ease;
}

@keyframes coin-flip {
  0%   { transform: scaleX(1); opacity: 1; }
  40%  { transform: scaleX(0); opacity: 0.3; }
  60%  { transform: scaleX(0); opacity: 0.3; }
  100% { transform: scaleX(1); opacity: 1; }
}

.register-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-register {
  flex: 1;
}

.notepad-empty {
  flex: 1;
  min-height: 100px;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 12px;
  border-top: 1px solid #2e2e2e;
}

.sum-label {
  color: var(--text-muted);
  font-size: 14px;
}

.sum-value {
  font-weight: 700;
  font-size: 16px;
}

.sum-value.zero { color: var(--success); }
.sum-value.nonzero { color: var(--danger); }

/* ===== BUY-IN MODE ===== */
.buyin-players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.buyin-player-card {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid transparent;
  transition: border-color var(--transition);
}

.buyin-player-card.has-buyin {
  border-color: var(--gold-dim);
}

.buyin-player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.buyin-player-name {
  flex: 1;
  font-weight: 600;
}

.buyin-net {
  font-size: 14px;
  font-weight: 700;
}

.buyin-net.positive { color: var(--success); }
.buyin-net.negative { color: var(--danger); }
.buyin-net.zero { color: var(--text-muted); }

.buyin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.buyin-stat {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
}

/* ===== HISTORY ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
  opacity: 0;
  animation: listItemIn 0.4s var(--ease-out-expo) both;
}

.history-item:nth-child(1) { animation-delay: 0.04s; }
.history-item:nth-child(2) { animation-delay: 0.08s; }
.history-item:nth-child(3) { animation-delay: 0.12s; }
.history-item:nth-child(4) { animation-delay: 0.16s; }
.history-item:nth-child(5) { animation-delay: 0.20s; }
.history-item:nth-child(6) { animation-delay: 0.24s; }
.history-item:nth-child(7) { animation-delay: 0.28s; }
.history-item:nth-child(8) { animation-delay: 0.32s; }

@keyframes listItemIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.history-item:hover {
  border-color: var(--gold-dim);
  background: rgba(212, 175, 55, 0.03);
}

.history-item:active {
  transform: scale(0.99);
  background: rgba(212, 175, 55, 0.05);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.history-item-name {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}

.history-item-date {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.history-item-type {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.history-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.history-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.history-total-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-3);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 13px;
}

.history-total-chip.positive .history-total-val { color: var(--positive); }
.history-total-chip.negative .history-total-val { color: var(--danger); }

.history-total-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-total-name {
  color: var(--text-muted);
}

.history-total-val {
  font-weight: 600;
}

/* ===== MODALS ===== */
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes sheetSlideDown {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  z-index: 500;
  padding-bottom: env(safe-area-inset-bottom);
  animation: overlayFadeIn 0.25s ease both;
}

.modal-overlay.hidden {
  display: none;
}

.modal-overlay.closing {
  animation: overlayFadeOut 0.25s ease both;
}

.modal-overlay.closing .modal {
  animation: sheetSlideDown 0.28s cubic-bezier(.32,.72,0,1) both;
}

.modal {
  position: relative;
  background: var(--bg-2);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: sheetSlideUp 0.38s cubic-bezier(.32,.72,0,1) both;
  touch-action: pan-y;
  will-change: transform;
  border-top: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}

/* Drag handle */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: -8px auto 4px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.modal:hover::before {
  background: rgba(255,255,255,0.28);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  z-index: 1;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--text);
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  padding-right: 28px;
}

.modal-subtitle {
  color: var(--text-muted);
  margin-top: -8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
}

/* ===== TYPE SELECTOR ===== */
.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-btn {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.type-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== PLAYER CHECKBOXES ===== */
.player-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-checkbox-btn {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s ease, transform 0.15s var(--spring);
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}

.player-checkbox-btn:active {
  transform: scale(0.94);
}

.player-checkbox-btn.selected {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
  animation: chipPop 0.3s var(--spring) both;
}

@keyframes chipPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ===== GROUP SETTINGS ===== */
.group-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.group-code-display .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.group-code-value {
  flex: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--gold);
}

.group-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}

.group-player-name {
  flex: 1;
  font-weight: 500;
}

.btn-remove-player {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-remove-player:hover {
  color: var(--danger, #e05252);
  background: rgba(224, 82, 82, 0.1);
}

/* ===== DETAIL ENTRIES ===== */
.detail-entries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-entry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.detail-entry-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-entry-player {
  font-weight: 600;
}

.detail-entry-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.detail-entry-amount {
  font-weight: 700;
}

.detail-entry-amount.positive { color: var(--success); }
.detail-entry-amount.negative { color: var(--danger); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(46, 46, 46, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.toast:not(.hidden) {
  animation: toastIn 0.35s var(--spring) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
}

/* ===== MISC ===== */
.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ===== CHART ===== */
.modal-chart {
  max-height: 90vh;
  overflow-y: auto;
  touch-action: pan-y;
}

.chart-tab-panel.hidden {
  display: none;
}

.btn-open-chart-from-stats {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px 2px 0;
  border-radius: 8px;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
  touch-action: manipulation;
  flex-shrink: 0;
}

.btn-open-chart-from-stats:hover {
  opacity: 1;
  transform: scale(1.18);
}

.btn-open-chart-from-stats:active {
  transform: scale(0.92);
}

.btn-icon--chart:hover {
  opacity: 1;
  transform: scale(1.18);
  color: inherit;
}

.btn-icon--chart:active {
  transform: scale(0.92);
}

.btn-chart-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-style: italic;
  cursor: pointer;
  padding: 6px 2px 10px;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
  touch-action: manipulation;
}

.btn-chart-back:hover {
  opacity: 1;
  transform: translateX(-2px);
}

.btn-chart-back:active {
  opacity: 0.6;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* Session stats i diagram-modalen */
.chart-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chart-stats-player {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-stats-player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bg-3);
}

.chart-stats-player-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.chart-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.chart-stat-row-label {
  color: var(--text-muted);
}

.chart-stat-row-value {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.chart-stat-row-value.positive { color: #27ae60; }
.chart-stat-row-value.negative { color: #c0392b; }

.chart-stats-divider {
  height: 1px;
  background: var(--bg-3);
  margin: 4px 0;
}

.chart-stats-section-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

/* ===== FOOTER SIGNATURE ===== */
.app-signature {
  text-align: center;
  font-size: 11px;
  color: #444;
  padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  pointer-events: none;
}

/* ===== POINT VALUE ROW ===== */
.point-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid #2a2a2a;
}

.point-value-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.point-value-input {
  width: 80px;
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 4px 8px;
  text-align: center;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== SESSION ROUNDS – anteckningsblock ===== */
.session-rounds-list {
  margin-top: 16px;
  position: relative;
  background: #f5e96a;
  border-radius: 4px 4px 6px 6px;
  box-shadow:
    0 2px 0 #c8bc3a,
    0 4px 0 #b0a530,
    0 6px 12px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.6);
  overflow: hidden;
  padding: 10px 0 6px;
  min-height: 100%;
}

/* Spiral-hål */
.session-rounds-list::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 28px,
    #1a1a1a 28px,
    #1a1a1a 44px
  );
  opacity: 0.18;
  z-index: 1;
}

/* Röd marginal-linje */
.session-rounds-list::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 44px;
  width: 1.5px;
  background: rgba(220, 80, 80, 0.55);
  z-index: 1;
  pointer-events: none;
}

.round-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 54px;
  border-bottom: 1px solid rgba(100,140,200,0.2);
  background: transparent;
  position: relative;
  opacity: 0;
  animation: roundRowIn 0.3s var(--ease-out-expo) both;
}

@keyframes roundRowIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.round-row:last-child {
  border-bottom: none;
}

.round-latest {
  background: rgba(255,255,255,0.25);
  animation: roundRowLatest 0.35s var(--spring) both;
}

@keyframes roundRowLatest {
  from { opacity: 0; transform: translateX(14px); background: rgba(255,255,255,0.4); }
  to   { opacity: 1; transform: translateX(0); background: rgba(255,255,255,0.25); }
}

.round-old {
  opacity: 0.6;
  text-decoration: line-through;
  text-decoration-color: rgba(26,26,26,0.5);
}

.round-entry {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 400;
  color: #1a1a1a;
}

/* Ångra-knapp i marginalen */
.btn-undo-round {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
  color: #c0392b;
  font-size: 18px;
  line-height: 1;
  touch-action: manipulation;
}
.btn-undo-round:active {
  opacity: 1;
  transform: translateY(-50%) scale(0.88);
}

.notepad-total-circle {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  font-weight: 700;
  color: #c0392b;
  position: absolute;
  top: 14px;
  right: 16px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #c0392b;
  border-radius: 52% 48% 50% 46% / 46% 54% 48% 52%;
  transform: rotate(-4deg);
  z-index: 2;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.session-screen-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.session-sticky-top {
  flex-shrink: 0;
  padding: 16px 16px 12px;
  background: var(--bg);
  z-index: 10;
}

.session-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px calc(var(--nav-height) + 60px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  position: relative;
  touch-action: pan-y;
}

.session-sticky-total {
  position: fixed;
  bottom: 60px; /* ovanför bottom nav */
  left: 0;
  right: 0;
  background: var(--bg-2);
  border-top: 2px solid #2a2a2a;
  padding: 8px 16px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 200;
}

.rounds-total-row {
  display: grid;
  grid-template-columns: repeat(var(--total-cols, 3), 1fr);
  gap: 6px 8px;
}

.total-entry {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.total-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.total-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.total-value {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.total-entry.positive .total-value { color: #4caf6e; }
.total-entry.negative .total-value { color: #e05252; }
.total-entry:not(.positive):not(.negative) .total-value { color: var(--text-muted); }

/* ===== SPARADE GRUPPER ===== */
.saved-groups-list {
  width: 100%;
  margin-bottom: 12px;
}

.saved-groups-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.saved-group-btn {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.saved-group-btn:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background: var(--bg-3);
}

.saved-group-btn:active {
  transform: scale(0.98);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.04);
}

.saved-group-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  min-width: 64px;
}

.saved-group-code {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.saved-group-date {
  font-size: 11px;
  color: var(--text-muted);
}

.saved-group-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #c8a84e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.saved-group-name {
  font-size: 13px;
  color: var(--text-muted);
  flex: 0 0 auto;
  text-align: right;
  margin-right: 8px;
}

.saved-group-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex: 0 0 auto;
}

/* ===== CLOSED SESSIONS ON DASHBOARD ===== */
.closed-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.closed-session-item {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  animation: listItemIn 0.4s var(--ease-out-expo) both;
}

.closed-session-delete {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.closed-session-delete:hover,
.closed-session-delete:active {
  opacity: 1;
  color: var(--danger);
  background: rgba(224, 82, 82, 0.08);
}

.detail-modal-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-3);
  display: flex;
  justify-content: center;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(224, 82, 82, 0.4);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-danger-ghost:hover,
.btn-danger-ghost:active {
  background: rgba(224, 82, 82, 0.08);
  border-color: var(--danger);
}

.delete-confirm-box {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(224, 82, 82, 0.35);
  border-radius: var(--radius);
  background: rgba(224, 82, 82, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.delete-confirm-box.hidden {
  display: none;
}

.delete-confirm-warning {
  margin: 0;
  font-size: 0.85rem;
  color: var(--danger);
  line-height: 1.5;
}

.delete-confirm-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.delete-confirm-name {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.delete-confirm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.delete-confirm-input:focus {
  border-color: var(--danger);
}

#btn-delete-group-final:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.closed-session-item:nth-child(1) { animation-delay: 0.05s; }
.closed-session-item:nth-child(2) { animation-delay: 0.10s; }
.closed-session-item:nth-child(3) { animation-delay: 0.15s; }
.closed-session-item:nth-child(4) { animation-delay: 0.20s; }
.closed-session-item:nth-child(5) { animation-delay: 0.25s; }

.closed-session-item:active {
  transform: scale(0.99);
  border-color: var(--gold-dim);
  background: rgba(212, 175, 55, 0.03);
}

/* ===== STATISTICS ===== */
.stats-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stats-chart-inline-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: transform 0.18s var(--spring), background 0.15s ease;
  opacity: 0.85;
}
.stats-chart-inline-btn:active {
  transform: scale(0.84);
  background: var(--bg-3);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats-grid-sm .stat-card {
  padding: 10px 12px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  animation: statCardIn 0.45s var(--ease-out-expo) both;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

.stat-card--positive {
  border-color: rgba(39, 174, 96, 0.35);
}
.stat-card--positive .stat-value {
  color: #27ae60;
}
.stat-card--negative {
  border-color: rgba(192, 57, 43, 0.35);
}
.stat-card--negative .stat-value {
  color: #c0392b;
}

@keyframes statCardIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.stats-player-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-player-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-player-name {
  font-weight: 600;
  font-size: 16px;
}

/* ===== SESSION DETAIL – STATISTIK ===== */

.modal-session-detail {
  padding-bottom: 24px;
}

.modal-session-detail .modal-close-btn {
  position: sticky;
  top: -24px;
  align-self: flex-end;
  margin-bottom: -36px;
}

.detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-right: 32px;
}


.detail-session-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 0;
}

.btn-detail-unit {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
  flex-shrink: 0;
}

.btn-detail-unit:hover {
  background: var(--gold);
  color: #1a1a2e;
}

.btn-detail-unit-active {
  background: var(--gold);
  color: #1a1a2e;
}

.btn-detail-unit.hidden {
  display: none;
}

.sd-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.sd-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sd-meta-row .btn-detail-unit {
  margin-left: auto;
}

.stats-unit-fab-row {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-unit-fab-toggle {
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  font-size: 12px;
  padding: 5px 14px;
}

.stats-chart-fab-btn {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: transform 0.18s var(--spring), background 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}

.stats-chart-fab-btn:active {
  transform: scale(0.88);
}

.sd-meta-chip {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-3);
  border-radius: 20px;
  padding: 4px 10px;
  letter-spacing: 0.02em;
}

.sd-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: -8px;
}

/* Podium / resultat */
.sd-podium {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sd-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.2s;
}

.sd-winner {
  border-color: rgba(212, 175, 55, 0.35);
  background: linear-gradient(135deg, rgba(212,175,55,0.06) 0%, var(--bg-2) 100%);
}

.sd-medal {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sd-player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sd-player-name {
  flex: 1;
  font-weight: 500;
  font-size: 15px;
}

.sd-wl-win { color: var(--success); }
.sd-wl-loss { color: var(--danger); }

.sd-player-total {
  font-weight: 700;
  font-size: 16px;
  font-family: 'Playfair Display', serif;
}

.sd-player-total.pos { color: var(--success); }
.sd-player-total.neg { color: var(--danger); }

/* Höjdpunkter */
.sd-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sd-highlight-card {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sd-highlight-card.sd-animate-in {
  opacity: 1;
  transform: translateY(0);
}

.sd-highlight-streak { border-color: rgba(255, 130, 0, 0.25); }
.sd-highlight-best   { border-color: rgba(100, 180, 255, 0.2); }
.sd-highlight-winner { border-color: rgba(212, 175, 55, 0.3); }
.sd-highlight-rounds { border-color: rgba(76, 175, 130, 0.2); }

.sd-hl-icon {
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}

.sd-hl-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sd-hl-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.sd-hl-value {
  font-size: 17px;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
  color: var(--text);
  line-height: 1.2;
}

.sd-hl-who {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Per-spelare stats */
.sd-player-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sd-pstat-row {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sd-pstat-row.sd-animate-in {
  opacity: 1;
  transform: translateY(0);
}

.sd-pstat-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sd-avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.sd-pstat-name {
  font-weight: 600;
  font-size: 14px;
}

.sd-pstat-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sd-chip {
  font-size: 11px;
  background: var(--bg-3);
  border-radius: 20px;
  padding: 3px 9px;
  color: var(--text-muted);
  white-space: nowrap;
}
.sd-chip--pos {
  background: rgba(102, 187, 106, 0.12);
  color: #66bb6a;
}
.sd-chip--neg {
  background: rgba(224, 82, 82, 0.12);
  color: #e05252;
}

/* Player row / pstat row shared animation */
.sd-player-row {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s;
}

.sd-player-row.sd-animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* ===== SD COMPACT (chart-modal-läge) ===== */
/* Minimierar alla sd-* komponenter för att rymmas i chart-modalen */

.sd-body--compact {
  gap: 10px;
  margin-top: 0;
}

.sd-body--compact .sd-meta-row {
  gap: 6px;
}

.sd-body--compact .sd-meta-chip {
  font-size: 11px;
  padding: 3px 8px;
}

.sd-body--compact .sd-section-label {
  font-size: 10px;
  letter-spacing: 1px;
  margin-bottom: -4px;
}

.sd-body--compact .sd-podium {
  gap: 4px;
}

.sd-body--compact .sd-player-row {
  padding: 7px 10px;
  gap: 8px;
}

.sd-body--compact .sd-player-avatar {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.sd-body--compact .sd-player-name {
  font-size: 13px;
}

.sd-body--compact .sd-player-total {
  font-size: 13px;
}

.sd-body--compact .sd-highlights {
  gap: 6px;
}

.sd-body--compact .sd-highlight-card {
  padding: 9px 10px;
  gap: 8px;
}

.sd-body--compact .sd-hl-icon {
  font-size: 16px;
}

.sd-body--compact .sd-hl-title {
  font-size: 9px;
}

.sd-body--compact .sd-hl-value {
  font-size: 14px;
}

.sd-body--compact .sd-hl-who {
  font-size: 11px;
}

.sd-body--compact .sd-player-stats {
  gap: 5px;
}

.sd-body--compact .sd-pstat-row {
  padding: 7px 10px;
  gap: 4px;
}

.sd-body--compact .sd-avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.sd-body--compact .sd-pstat-name {
  font-size: 12px;
}

.sd-body--compact .sd-chip {
  font-size: 10px;
  padding: 2px 7px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.35);
}

/* ===== INPUT HIGHLIGHT ===== */

@keyframes inputHighlightPulse {
  0%   { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212,175,55,0.35); }
  60%  { border-color: var(--gold); box-shadow: 0 0 0 8px rgba(212,175,55,0); }
  100% { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,0.12); }
}

.input--highlight {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(212,175,55,0.12) !important;
  animation: inputHighlightPulse 0.55s cubic-bezier(.22,.9,.36,1) both;
}

/* ===== MOBILE GLOBAL IMPROVEMENTS ===== */

/* Prevent double-tap zoom on buttons */
button, a, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== NO POINT VALUE CONFIRMATION MODAL ===== */

.modal--center-sheet {
  border-radius: 20px;
  max-width: 340px;
  width: calc(100% - 32px);
  margin: 16px;
  padding: 28px 24px 24px;
  gap: 20px;
  animation: npvModalIn 0.4s cubic-bezier(.22,.9,.36,1) both;
}

@keyframes npvModalIn {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-overlay--center.closing .modal--center-sheet {
  /* Överskuggar sheetSlideDown för center-modaler */
  animation: npvModalOut 0.22s cubic-bezier(.4,0,1,1) both;
}

@keyframes npvModalOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.92) translateY(8px); }
}

.npv-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.npv-icon {
  width: 44px;
  height: 44px;
  color: var(--gold);
  position: relative;
  z-index: 1;
  animation: npvIconFloat 3s ease-in-out infinite;
}

@keyframes npvIconFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

.npv-icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 175, 55, 0.25);
  animation: npvRingPulse 2.4s ease-in-out infinite;
}

@keyframes npvRingPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.npv-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.npv-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.npv-body {
  font-size: 14px;
  color: var(--text-secondary, var(--text));
  line-height: 1.55;
  margin: 0;
  opacity: 0.85;
}

.npv-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.npv-actions {
  flex-direction: column;
  gap: 8px;
}

.npv-actions .btn {
  flex: unset;
  width: 100%;
}

/* Smoother momentum scrolling everywhere */
.screen-content,
.session-scroll-area,
.modal {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Prevent text selection on interactive elements */
.nav-btn,
.btn,
.btn-icon,
.fab,
.settlement-toggle {
  user-select: none;
  -webkit-user-select: none;
}

/* Selection color match brand */
::selection {
  background: rgba(212, 175, 55, 0.3);
  color: var(--text);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== TRANSACTION HISTORY ===== */

.btn-tx-history {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.btn-tx-history:hover {
  opacity: 1;
  transform: scale(1.15);
}

.btn-tx-history:active {
  transform: scale(0.95);
}

.modal-tx-history {
  max-height: 80vh;
}

.tx-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.tx-history-item {
  background: var(--bg-3);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: txItemIn 0.28s cubic-bezier(.32,.72,0,1) both;
}

@keyframes txItemIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tx-history-names {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
}

.tx-from {
  color: var(--text);
}

.tx-arrow {
  color: var(--text-muted);
  font-size: 13px;
}

.tx-to {
  color: var(--gold);
}

.tx-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tx-amount {
  font-size: 14px;
  font-weight: 700;
  color: #27ae60;
}

.tx-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== STATS CHART MODAL ===== */

.modal-stats-chart {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.stats-chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--gold);
  text-align: center;
  margin-top: 4px;
}

.stats-chart-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 2px;
}

.stats-chart-container {
  flex: 1;
  min-height: 260px;
  max-height: 420px;
  position: relative;
}

/* ===== ONBOARDING TOOLTIP TOUR ===== */

.ob-overlay {
  position: fixed;
  inset: 0;
  z-index: 10003;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.ob-overlay.ob-visible {
  opacity: 1;
  pointer-events: auto;
}

.ob-overlay.ob-hiding {
  animation: ob-fade-out 0.4s ease forwards;
  pointer-events: none;
}

@keyframes ob-fade-out {
  to { opacity: 0; }
}

/* Dim backdrop – hidden, dimning sker via spotlight box-shadow */
.ob-backdrop {
  display: none;
}

/* Spotlight ring – box-shadow skapar hålet i dimman */
.ob-spotlight {
  position: fixed;
  pointer-events: none;
  z-index: 10004;
  border-radius: 12px;
  box-shadow:
    0 0 0 9999px rgba(10, 8, 5, 0.72),
    0 0 0 2px rgba(212, 175, 55, 0.8),
    0 0 28px 8px rgba(212, 175, 55, 0.4);
  transition:
    left 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    height 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
  animation: ob-spotlight-pulse 2.5s ease-in-out infinite;
}

@keyframes ob-spotlight-pulse {
  0%, 100% { box-shadow:
    0 0 0 9999px rgba(10, 8, 5, 0.72),
    0 0 0 2px rgba(212, 175, 55, 0.8),
    0 0 28px 8px rgba(212, 175, 55, 0.4); }
  50% { box-shadow:
    0 0 0 9999px rgba(10, 8, 5, 0.72),
    0 0 0 2px rgba(212, 175, 55, 1),
    0 0 44px 14px rgba(212, 175, 55, 0.6); }
}

/* Tooltip card */
.ob-tooltip {
  position: fixed;
  z-index: 10005;
  background: linear-gradient(145deg, #1c1a12 0%, #12100a 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow:
    0 24px 64px rgba(0,0,0,0.7),
    0 0 0 1px rgba(212, 175, 55, 0.1),
    inset 0 1px 0 rgba(212, 175, 55, 0.15);
  max-width: min(340px, calc(100vw - 24px));
}

.ob-tooltip::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  top: 0;
  left: 0;
  background: linear-gradient(90deg, transparent 5%, rgba(212,175,55,0.5) 50%, transparent 95%);
  border-radius: 16px 16px 0 0;
}

/* Arrow indicators */
.ob-tooltip[data-arrow="top"]::after {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid rgba(212, 175, 55, 0.45);
}

.ob-tooltip[data-arrow="bottom"]::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid rgba(212, 175, 55, 0.45);
}

.ob-tooltip-enter {
  animation: ob-tooltip-pop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ob-tooltip-pop {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ob-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ob-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.7));
  animation: ob-icon-float 3s ease-in-out infinite;
}

@keyframes ob-icon-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}

.ob-step-count {
  font-family: 'Playfair Display', serif;
  font-size: 11px;
  font-style: italic;
  color: rgba(212, 175, 55, 0.55);
  letter-spacing: 1px;
}

.ob-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: #f5e070;
  margin: 0 0 8px;
  line-height: 1.25;
  text-shadow: 0 0 20px rgba(212,175,55,0.3);
}

.ob-body {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 400;
  color: rgba(240, 225, 180, 0.85);
  line-height: 1.5;
  margin: 0 0 16px;
}

.ob-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ob-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
}

.ob-nav-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ob-btn-skip {
  font-size: 12px;
  color: rgba(212, 175, 55, 0.45);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ob-btn-skip:hover { color: rgba(212, 175, 55, 0.8); }

.ob-btn-prev {
  font-size: 12px;
  color: rgba(212, 175, 55, 0.55);
  background: none;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  cursor: pointer;
  padding: 5px 10px;
  font-family: inherit;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.ob-btn-prev:hover {
  color: rgba(212, 175, 55, 0.85);
  border-color: rgba(212, 175, 55, 0.5);
}

.ob-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.ob-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.22);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.ob-dot--active {
  width: 18px;
  border-radius: 3px;
  background: linear-gradient(90deg, #b8922a, #f5e070, #d4af37);
  box-shadow: 0 0 6px rgba(212,175,55,0.6);
}

.ob-dot:hover:not(.ob-dot--active) {
  background: rgba(212, 175, 55, 0.45);
}

.ob-btn-next {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  color: #1a1a2e;
  background: linear-gradient(135deg, #b8922a 0%, #f5e070 50%, #d4af37 100%);
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  cursor: pointer;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 2px 12px rgba(212,175,55,0.35);
}

.ob-btn-next:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 20px rgba(212,175,55,0.5);
  filter: brightness(1.08);
}

.ob-btn-next:active {
  transform: scale(0.97);
}

.ob-btn-next--last {
  background: linear-gradient(135deg, #1a6b3a 0%, #2ea05a 50%, #1d7e45 100%);
  box-shadow: 0 2px 12px rgba(46,160,90,0.4);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  font-style: normal;
}

.ob-btn-next--last:hover {
  box-shadow: 0 6px 20px rgba(46,160,90,0.55);
}

@media (prefers-reduced-motion: reduce) {
  .ob-spotlight,
  .ob-icon,
  .ob-tooltip,
  .ob-overlay { animation: none !important; transition: none !important; }
}

/* ── Demo session overlay ── */
#ob-demo-session {
  position: fixed;
  inset: 0;
  z-index: 10000; /* under ob-overlay (10001) but above everything else */
  background: #0e0c07;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  overflow: hidden;
}

#ob-demo-session.ob-demo-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#ob-demo-session .ob-demo-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#ob-demo-session .session-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

#ob-demo-session .session-rounds-list {
  min-height: unset;
}

/* ===== LANDSCAPE BLOCK ===== */
#landscape-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #1a1a1a;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#landscape-overlay svg {
  width: 64px;
  height: 64px;
  color: var(--gold);
  animation: rotatePulse 2s ease-in-out infinite;
}

#landscape-overlay p {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  color: var(--text-muted);
  text-align: center;
}

@keyframes rotatePulse {
  0%, 100% { transform: rotate(0deg); opacity: 0.7; }
  50%       { transform: rotate(15deg); opacity: 1; }
}

@media (orientation: landscape) {
  #landscape-overlay {
    display: flex;
  }
}
