/* ──────── View System ──────── */
.view {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 80px 16px 60px;
  overflow-y: auto;
}
.view--active { display: flex; }

/* ──────── Splash ──────── */
.splash {
  text-align: center;
  max-width: 560px;
}
.loading-logo {
  position: relative;
  height: 130px;
  display: flex; justify-content: center; align-items: center;
  margin-bottom: var(--space-5);
}
.logo-card {
  width: 80px; height: 110px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--ivory), var(--cream));
  color: var(--black-deep);
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px var(--shadow-deep), inset 0 0 0 2px var(--gold);
  position: absolute;
}
.logo-card--1 { transform: translateX(-90px) rotate(-12deg); }
.logo-card--2 { transform: translateX(-30px) rotate(-4deg);  color: var(--red-card); }
.logo-card--3 { transform: translateX(30px)  rotate(4deg);   color: var(--red-card); }
.logo-card--4 { transform: translateX(90px)  rotate(12deg); }

.splash-title {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--gold-light);
  letter-spacing: 1px;
  text-shadow: 0 4px 18px rgba(0,0,0,0.55);
  margin-bottom: var(--space-2);
}
.splash-subtitle {
  font-size: 14px;
  color: var(--cream);
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: var(--space-6);
}

.phase-tag {
  margin-top: var(--space-5);
  font-size: 11px;
  color: var(--gold-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ──────── Menu Panel ──────── */
.menu-panel {
  width: min(520px, 100%);
  background: linear-gradient(160deg,
    rgba(15, 92, 70, 0.85),
    rgba(10, 61, 47, 0.92));
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(212, 175, 55, 0.25),
    0 0 60px rgba(212, 175, 55, 0.08);
  backdrop-filter: blur(8px);
  text-align: center;
  position: relative;
}
.menu-panel::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--radius-lg) - 4px);
  border: 1px solid rgba(212, 175, 55, 0.35);
  pointer-events: none;
}
.menu-panel--wide   { width: min(640px, 100%); }
.menu-panel--scroll { max-height: 80vh; overflow-y: auto; }

.menu-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--gold-light);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: var(--space-5);
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}

.menu-note {
  margin-top: var(--space-4);
  font-size: 12px;
  color: var(--cream);
  opacity: 0.7;
  letter-spacing: 1px;
}

/* ──────── Buttons ──────── */
.btn {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  padding: 14px 28px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background var(--t-fast), color var(--t-fast);
  min-width: 220px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.btn--large { padding: 18px 44px; font-size: 17px; min-width: 260px; }
.btn--small { padding: 8px 14px;  font-size: 12px; min-width: auto; letter-spacing: 1px; }

.btn--primary {
  background: linear-gradient(180deg, var(--gold-light), var(--gold), var(--gold-dark));
  color: #2a1d05;
  border: 1px solid var(--gold);
  box-shadow:
    0 8px 18px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -2px 0 rgba(0,0,0,0.15);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 26px rgba(0,0,0,0.55),
    0 0 24px rgba(212,175,55,0.55),
    inset 0 1px 0 rgba(255,255,255,0.6);
}

.btn--secondary {
  background: rgba(0,0,0,0.4);
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
}
.btn--secondary:hover {
  background: rgba(212, 175, 55, 0.18);
  box-shadow: 0 6px 18px rgba(212,175,55,0.35);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(244,236,216,0.25);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(244,236,216,0.45);
}

.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ──────── Form Rows ──────── */
.form-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 14px auto;
  max-width: 360px;
  width: 100%;
}
.form-row label {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  opacity: 0.85;
}
.form-row input {
  width: 100%;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--gold-dark);
  color: var(--ivory);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-row input:focus {
  outline: none;
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.25);
}

/* ──────── Room Code Display ──────── */
.room-code-display {
  margin: 22px auto;
  padding: 18px 24px;
  background: rgba(0,0,0,0.45);
  border: 1px dashed var(--gold);
  border-radius: 12px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 280px;
}
.room-code-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-light);
  opacity: 0.8;
}
.room-code {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--gold-light);
  letter-spacing: 8px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(212,175,55,0.45);
}

/* ──────── Settings (Segmented Buttons) ──────── */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}
.setting-row:last-of-type { border-bottom: 0; }

.setting-label {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  flex-shrink: 0;
}

.seg {
  display: flex;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--cream);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--t-fast);
  text-transform: uppercase;
}
.seg-btn:hover { background: rgba(212, 175, 55, 0.12); }
.seg-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  color: #2a1d05;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

/* ──────── Rules text ──────── */
.rules-text {
  text-align: start;
  color: var(--cream);
  font-size: 14px;
  line-height: 1.7;
  padding: 8px 4px;
}
.rules-text h3 {
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 18px;
  margin: 16px 0 8px;
  letter-spacing: 1px;
}
.rules-text ul { padding-inline-start: 22px; margin: 6px 0 12px; }
.rules-text li { margin: 4px 0; }
.rules-text strong { color: var(--gold-light); }

/* ──────── Modal ──────── */
.modal-host {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-host.is-open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}
.modal {
  position: relative;
  width: min(440px, 92%);
  background: linear-gradient(160deg, rgba(15, 92, 70, 0.95), rgba(10, 61, 47, 0.98));
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow:
    0 30px 70px rgba(0,0,0,0.65),
    inset 0 0 0 1px rgba(212, 175, 55, 0.3);
  animation: modalIn 240ms cubic-bezier(.2,.7,.3,1.2);
  overflow: hidden;
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  text-align: center;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold-light);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.modal-body {
  padding: 22px;
  font-size: 14px;
  color: var(--cream);
  line-height: 1.6;
  text-align: center;
}
.modal-footer {
  padding: 14px 22px 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ──────── Toast ──────── */
.toast-host {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.85);
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  letter-spacing: 1px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5);
  animation: toastIn 220ms ease, toastOut 220ms ease 2.6s forwards;
  pointer-events: auto;
}
.toast--success { color: #b8f4c8; border-color: #2c8a4a; }
.toast--error   { color: #f9bcbc; border-color: #c44; }
.toast--info    { color: var(--gold-light); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-8px); } }

/* ──────── Bidding modal ──────── */
.bid-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 4px 0;
}
.bid-grid .btn {
  min-width: auto;
  padding: 10px 6px;
  font-size: 13px;
}
.btn--shalam {
  background: linear-gradient(180deg, #f4d775, #c41e1e) !important;
  color: var(--ivory) !important;
  font-weight: 700;
  letter-spacing: 2px;
  grid-column: span 5;
  margin-top: 6px;
  font-size: 14px !important;
  box-shadow: 0 4px 14px rgba(196, 30, 30, 0.45) !important;
}

/* ──────── Trump modal ──────── */
.trump-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 4px 0;
}
.trump-btn {
  background: linear-gradient(160deg, var(--ivory), var(--cream));
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}
.trump-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.5), 0 0 18px rgba(212,175,55,0.45);
}
.trump-glyph {
  font-size: 42px;
  font-family: serif;
  line-height: 1;
}
.trump-name {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #2a1d05;
  font-weight: 700;
}

/* ──────── Discard modal ──────── */
.discard-wrap { width: 100%; }
.discard-help {
  text-align: center;
  font-size: 13px;
  color: var(--cream);
  opacity: 0.8;
  margin-bottom: 6px;
}
.discard-counter {
  text-align: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-light);
  margin-bottom: 12px;
  letter-spacing: 3px;
}
.discard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.discard-grid .card {
  width: 100%;
  height: 92px;
}

/* ──────── Round result ──────── */
.round-result { font-size: 14px; min-width: 280px; }
.rr-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
}
.rr-row b      { color: var(--gold-light); }
.rr-row .pos   { color: #6cd28b; }
.rr-row .neg   { color: #f0a0a0; }
.rr-row--us    b, .rr-row--them   b { font-size: 18px; }
.rr-row--total b { font-size: 20px; color: var(--gold-light); }
.rr-divider {
  height: 1px;
  background: rgba(212,175,55,0.3);
  margin: 8px 0;
}
.game-over .go-row {
  display: flex; justify-content: space-between;
  font-size: 18px;
  padding: 8px 4px;
}
.game-over .go-row b { color: var(--gold-light); font-size: 24px; }

/* ──────── Trick area cards on table ──────── */
.trick-area .played-card {
  position: absolute;
  width: 78px;
  height: 108px;
  transition: all 300ms cubic-bezier(.2,.7,.3,1);
}
.trick-area .played-card--south { bottom: 5%;  left: 50%; transform: translateX(-50%); }
.trick-area .played-card--north { top: 5%;     left: 50%; transform: translateX(-50%); }
.trick-area .played-card--west  { left: 5%;    top: 50%;  transform: translateY(-50%); }
.trick-area .played-card--east  { right: 5%;   top: 50%;  transform: translateY(-50%); }

@media (max-width: 600px) {
  .trick-area .played-card { width: 50px; height: 70px; }
  .bid-grid { grid-template-columns: repeat(4, 1fr); }
  .btn--shalam { grid-column: span 4; }
  .discard-grid .card { height: 76px; }
}
/* ──────── Bid Log (inside bid modal) ──────── */
.bid-body { display: flex; flex-direction: column; gap: 12px; }

.bid-log {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 10px;
  padding: 8px 10px;
}
.bid-log-header {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  opacity: 0.85;
  text-align: center;
  margin-bottom: 6px;
}
.bid-log-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.bid-log-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 3px 4px;
  border-radius: 4px;
}
.bid-log-row--me {
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.35);
}
.bid-log-name {
  color: var(--cream);
  opacity: 0.85;
}
.bid-log-action {
  font-family: var(--font-display);
  font-weight: 700;
}
.bid-log-action--bid      { color: var(--gold-light); }
.bid-log-action--pass     { color: #aaa; }
.bid-log-action--shalam   { color: #ff8585; letter-spacing: 1px; }
.bid-log-action--waiting  { color: rgba(244,236,216,0.4); }

@media (max-width: 600px) {
  .bid-log-list { grid-template-columns: 1fr; }
}
/* ──────── Gameplay modals (bid / trump) ────────
   Anchored to top, transparent backdrop, no blur,
   so the player's hand at the bottom stays fully visible. */
.modal-host.is-gameplay {
  align-items: flex-start;
  padding-top: 72px;
}
.modal-host.is-gameplay .modal-backdrop {
  background: rgba(0, 0, 0, 0.30);            /* darker accent only, no full opacity */
  backdrop-filter: none;                       /* NO blur → cards stay sharp */
  -webkit-backdrop-filter: none;
}
.modal-host.is-gameplay .modal {
  width: min(460px, 92%);
  max-height: calc(100vh - 280px);             /* leave room for player hand */
  overflow-y: auto;
  box-shadow:
    0 30px 70px rgba(0,0,0,0.7),
    0 0 0 1px rgba(212, 175, 55, 0.4),
    0 0 40px rgba(212, 175, 55, 0.25);
}

@media (max-width: 600px) {
  .modal-host.is-gameplay {
    padding-top: 64px;
  }
  .modal-host.is-gameplay .modal {
    max-height: calc(100vh - 220px);
  }
}

@media (max-width: 380px) {
  .modal-host.is-gameplay {
    padding-top: 58px;
  }
  .modal-host.is-gameplay .modal {
    max-height: calc(100vh - 200px);
  }
}
/* ──────── Volume slider ──────── */
.seg-volume {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}
.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--gold-dark);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  border: 1px solid #5a4413;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  border: 1px solid #5a4413;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}
.volume-value {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--gold-light);
  letter-spacing: 1px;
  min-width: 40px;
  text-align: right;
}
/* ──────── Online Lobby ──────── */
.lobby-seat-list {
  margin: 18px auto;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lobby-seat {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
}
.lobby-seat-num {
  font-family: var(--font-display);
  color: var(--gold-light);
  font-size: 14px;
}
.lobby-seat-name {
  color: var(--cream);
  font-size: 14px;
}
.lobby-seat-type {
  font-size: 11px;
  color: var(--gold-dark);
  letter-spacing: 1px;
}
