/* ============================================================
   Oh Shit! Card Tracker — Art Deco Casino Noir
   ============================================================ */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  /* Backgrounds */
  --bg:           #09090b;
  --bg-surface:   #111118;
  --bg-raised:    #18181f;
  --bg-elevated:  #1f1f2a;
  --bg-input:     #0d0d14;

  /* Gold palette */
  --gold:         #c9a84c;
  --gold-shine:   #f0d080;
  --gold-dim:     #6b540f;
  --gold-glow:    rgba(201, 168, 76, 0.18);

  /* Semantic colours */
  --crimson:      #e03050;
  --emerald:      #34d074;
  --slate:        #6b7280;

  /* Text */
  --text-1:       #f0ece4;
  --text-2:       #8b8b9a;
  --text-3:       #3f3f50;

  /* Borders */
  --border:         rgba(255, 255, 255, 0.07);
  --border-gold:    rgba(201, 168, 76, 0.22);
  --border-strong:  rgba(255, 255, 255, 0.12);

  /* Trump colours (used via class) */
  --trump-red:    #e03050;
  --trump-black:  #e8f0fe;
  --trump-none:   #8b8b9a;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Shadows */
  --shadow-card:   0 8px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-gold:   0 0 24px rgba(201, 168, 76, 0.2);
  --shadow-glow:   0 0 40px rgba(201, 168, 76, 0.12);

  /* Transitions */
  --transition:     all 0.2s ease;
  --transition-btn: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.15s ease;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Nunito', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 168, 76, 0.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.01'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: var(--text-1);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--gold-shine); text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { color: var(--text-2); }
strong { color: var(--text-1); font-weight: 700; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

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

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

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); }
  50%       { box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.15); }
}

/* ============================================================
   SHIMMER TEXT
   ============================================================ */
.shimmer-text {
  background: linear-gradient(
    105deg,
    #8a6010 0%,
    #f0d080 30%,
    #c9a84c 50%,
    #f0d080 70%,
    #8a6010 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s linear infinite;
}

/* ============================================================
   TRUMP COLOUR CLASSES
   ============================================================ */
.trump-red   { color: var(--trump-red); }
.trump-black { color: var(--trump-black); }
.trump-none  { color: var(--trump-none); }

/* ============================================================
   ART DECO DIVIDERS
   ============================================================ */
.deco-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}
.deco-divider::before,
.deco-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}
.deco-divider-text {
  color: var(--gold-dim);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font-body);
}

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-link {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  text-decoration: none;
}

.nav-active-game {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.25);
  animation: pulse-gold 3s ease-in-out infinite;
}
.nav-active-game:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: rgba(201, 168, 76, 0.4);
}

.nav-pip {
  font-size: 0.7rem;
  opacity: 0.8;
}

.nav-logout { color: var(--text-3); }
.nav-logout:hover { color: #ff6b6b; background: rgba(224, 48, 80, 0.1); }

/* ============================================================
   MAIN CONTENT & FOOTER
   ============================================================ */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  animation: fadeUp 0.4s ease both;
}

.site-footer {
  text-align: center;
  padding: 1.25rem 1rem;
  color: var(--text-3);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  letter-spacing: 0.05em;
}

.footer-suits {
  font-size: 1rem;
  letter-spacing: 0.2em;
}

/* Colour footer suits */
.site-footer .footer-suits {
  background: linear-gradient(
    90deg,
    var(--trump-black) 0%,
    var(--trump-black) 24%,
    var(--trump-red)   25%,
    var(--trump-red)   49%,
    var(--trump-red)   50%,
    var(--trump-red)   74%,
    var(--trump-black) 75%,
    var(--trump-black) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  max-width: 1200px;
  margin: 0.75rem auto 0;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.925rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  animation: fadeIn 0.25s ease;
}
.flash-success {
  background: rgba(52, 208, 116, 0.08);
  border: 1px solid rgba(52, 208, 116, 0.3);
  border-left: 4px solid var(--emerald);
  color: var(--emerald);
}
.flash-error {
  background: rgba(224, 48, 80, 0.08);
  border: 1px solid rgba(224, 48, 80, 0.3);
  border-left: 4px solid var(--crimson);
  color: var(--crimson);
}
.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: inherit;
  opacity: 0.5;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 0.2rem;
  transition: opacity 0.15s;
}
.flash-close:hover { opacity: 1; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: rgba(17, 17, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(201, 168, 76, 0.06);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, transparent 0%, var(--gold-dim) 40%, var(--gold) 50%, var(--gold-dim) 60%, transparent 100%) 1;
  border-image-slice: 0 0 0 0 fill;
  position: relative;
}

/* Gold top-line accent using pseudo-element */
.card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold), var(--gold-dim), transparent);
  opacity: 0.7;
}

.card-header h2 { margin: 0; font-size: 1.25rem; }
.card-header .hint {
  font-size: 0.85rem;
  color: var(--text-3);
  margin-top: 0.3rem;
  font-family: var(--font-body);
  font-weight: 400;
}

.card-body { padding: 1.375rem; }

.card-footer {
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.925rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: var(--transition-btn);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #8a6010 0%, #c9a84c 40%, #f0d080 50%, #c9a84c 60%, #8a6010 100%);
  background-size: 200% auto;
  color: #09090b;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.25), 0 4px 12px rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: var(--radius-md);
}
.btn-primary:hover:not(:disabled) {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.4), 0 8px 20px rgba(0, 0, 0, 0.6);
  color: #09090b;
  text-decoration: none;
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  border-color: var(--border-gold);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  text-decoration: none;
}

.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.825rem; }
.btn-full { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}
.form-input::placeholder { color: var(--text-3); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-family: var(--font-body);
}
.badge-dealer {
  background: rgba(201, 168, 76, 0.12);
  border-color: rgba(201, 168, 76, 0.4);
  color: var(--gold);
}

.meta-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-gold);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-2);
  font-family: var(--font-body);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
}
.alert-warning {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-left: 4px solid var(--gold-dim);
  color: #d4a030;
}
.alert-warning strong { color: var(--gold); }
.alert-warning a { color: var(--gold); text-decoration: underline; }

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  animation: fadeUp 0.3s ease both;
}
.page-header h1 {
  margin: 0;
  position: relative;
  display: inline-block;
}
.page-header h1::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  margin-top: 0.4rem;
  background: linear-gradient(90deg, var(--gold), transparent);
  border-radius: 2px;
}
.page-subtitle {
  color: var(--text-3);
  font-size: 0.9rem;
  margin-top: 0.2rem;
  font-family: var(--font-body);
}
.page-header-actions { flex-shrink: 0; align-self: center; }

.back-link {
  font-size: 0.875rem;
  color: var(--text-3);
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  transition: color 0.15s;
}
.back-link:hover { color: var(--gold); }

.text-center { text-align: center; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 168, 76, 0.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.01'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-container {
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.5s ease both;
}

.login-card {
  position: relative;
  background: rgba(17, 17, 24, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  box-shadow: var(--shadow-card), 0 0 60px rgba(201, 168, 76, 0.08);
  overflow: hidden;
}

/* Corner ornaments on login card */
.login-card::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid rgba(201, 168, 76, 0.08);
  border-radius: calc(var(--radius-xl) - 4px);
  pointer-events: none;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 3rem;
  margin: 0.5rem 0 0;
  display: inline-block;
}

.login-subtitle {
  color: var(--text-3);
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.card-suits {
  font-size: 1.6rem;
  letter-spacing: 0.25em;
  display: block;
}

/* Colour the suits in the login row */
.card-suits {
  background: linear-gradient(
    90deg,
    var(--trump-black) 0%,
    var(--trump-black) 24%,
    var(--trump-red)   25%,
    var(--trump-red)   49%,
    var(--trump-red)   50%,
    var(--trump-red)   74%,
    var(--trump-black) 75%,
    var(--trump-black) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-form { margin-top: 1.75rem; }

/* ============================================================
   HOME PAGE
   ============================================================ */
.page-home {
  max-width: 720px;
  margin: 0 auto;
}

.home-hero {
  text-align: center;
  padding: 1.5rem 0 1.75rem;
  animation: fadeUp 0.3s ease both;
}

.home-title {
  font-size: 3.2rem;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
}

.home-subtitle {
  color: var(--text-3);
  margin: 0.3rem 0 0;
  font-size: 0.925rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.home-active-game,
.home-no-game {
  margin-bottom: 1.5rem;
  animation: fadeUp 0.4s ease 0.05s both;
}

/* Glowing gold border on active game card */
.home-active-game {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-card), 0 0 30px rgba(201, 168, 76, 0.1);
}

.active-game-info { margin-bottom: 1.25rem; }

.info-row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  color: var(--text-3);
  min-width: 80px;
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.info-value { color: var(--text-1); font-family: var(--font-body); }

.home-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-no-game .card-body { padding: 2.5rem; }

.home-cta-text {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  color: var(--text-2);
}

.home-secondary {
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-3);
  animation: fadeUp 0.4s ease 0.1s both;
}
.home-secondary a { color: var(--gold-dim); }
.home-secondary a:hover { color: var(--gold); }

.home-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
  animation: fadeUp 0.4s ease 0.15s both;
}

.home-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--text-2);
  transition: var(--transition);
  text-decoration: none;
  cursor: pointer;
  min-height: 120px;
}
.home-link-card:hover {
  color: var(--gold);
  border-color: var(--border-gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), var(--shadow-gold);
  text-decoration: none;
}

.link-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  display: block;
}

/* ============================================================
   NEW GAME PAGE
   ============================================================ */
.page-new-game {
  max-width: 600px;
  margin: 0 auto;
}

.seat-instructions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.player-drag-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-drag-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: default;
  transition: all 0.2s ease;
  user-select: none;
}
.player-drag-item:hover { border-color: var(--border-gold); background: var(--bg-elevated); }
.player-drag-item.drag-over {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  transform: scale(1.01);
}
.player-drag-item.dragging {
  opacity: 0.35;
  border-style: dashed;
  border-color: var(--gold-dim);
}
.player-drag-item.is-dealer {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  box-shadow: 0 0 16px rgba(201, 168, 76, 0.12);
}

.drag-handle {
  color: var(--gold-dim);
  font-size: 1.3rem;
  cursor: grab;
  padding: 0 0.15rem;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
}
.drag-handle:active { cursor: grabbing; }
.player-drag-item:hover .drag-handle { color: var(--gold); opacity: 1; }

.seat-label {
  font-size: 0.8rem;
  color: var(--text-3);
  min-width: 64px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.seat-number { color: var(--gold); font-family: var(--font-mono); }

.player-name {
  flex: 1;
  font-size: 1.05rem;
  color: var(--text-1);
  font-weight: 600;
}

.dealer-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.dealer-btn:hover { color: var(--gold); border-color: var(--gold-dim); background: rgba(201, 168, 76, 0.06); }
.player-drag-item.is-dealer .dealer-btn { display: none; }

.dealer-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(201, 168, 76, 0.14);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 100px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
  font-family: var(--font-body);
}

.dealer-info {
  margin-top: 1.25rem;
  padding: 0.8rem 1.1rem;
  background: rgba(201, 168, 76, 0.05);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.dealer-info-label {
  color: var(--text-3);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dealer-info-name {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
}

/* ============================================================
   SCORECARD
   ============================================================ */
.page-scorecard { }

.current-round-banner {
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--gold);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: var(--font-body);
}

.scorecard-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 640px;
}

.scorecard-table thead th {
  background: #0a0a0f;
  color: var(--gold);
  padding: 0.75rem 0.6rem;
  border-bottom: 2px solid rgba(201, 168, 76, 0.35);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-align: center;
}

.scorecard-table th.col-round,
.scorecard-table td.col-round {
  text-align: left;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #0a0a0f;
}

.scorecard-table thead .sticky-col { z-index: 3; }

/* Dealer crown on player column header */
.dealer-crown {
  color: var(--gold);
  font-size: 0.75rem;
  margin-left: 3px;
  opacity: 0.9;
}

.col-player.is-dealer {
  color: var(--gold-shine);
}

.round-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.round-row:hover { background: rgba(255, 255, 255, 0.015); }

/* Current round — gold left border + tinted bg */
.round-current {
  background: rgba(201, 168, 76, 0.05) !important;
  border-left: 4px solid var(--gold);
}
.round-current:hover { background: rgba(201, 168, 76, 0.09) !important; }
.round-future { opacity: 0.45; }

.round-info-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
}

.round-number {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold);
  font-size: 0.95rem;
  min-width: 18px;
}

.round-trump { font-size: 1.05rem; }
.round-cards {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

.round-enter-link {
  display: block;
  font-size: 0.75rem;
  color: var(--gold);
  padding: 0 0.8rem 0.45rem;
  white-space: nowrap;
  font-weight: 700;
  opacity: 0.8;
}
.round-enter-link:hover { opacity: 1; }

/* Score cells */
.score-cell {
  text-align: center;
  padding: 0.3rem 0.45rem;
  vertical-align: middle;
}

.delta-positive { background: rgba(52, 208, 116, 0.08); }
.delta-negative { background: rgba(224, 48, 80, 0.08); }
.delta-zero     { background: rgba(107, 114, 128, 0.06); }
.cell-future    { background: rgba(0, 0, 0, 0.1); }

.cell-delta {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}
.delta-positive .cell-delta { color: var(--emerald); }
.delta-negative .cell-delta { color: var(--crimson); }
.delta-zero     .cell-delta { color: var(--slate); font-weight: 400; }

.cell-detail {
  font-size: 0.68rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.cell-total {
  font-size: 0.72rem;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.cell-empty {
  color: var(--text-3);
  font-size: 0.8rem;
}
.cell-pending {
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Totals footer row */
.totals-row {
  background: #0a0a0f;
  border-top: 2px solid rgba(201, 168, 76, 0.35);
}
.totals-row td {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
}
.totals-row .sticky-col {
  padding: 0.75rem 0.8rem;
  color: var(--text-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
}
.total-cell {
  font-size: 1rem;
  color: var(--text-1);
}
.winner-total { color: var(--gold) !important; }
.winner-star {
  color: var(--gold);
  margin-left: 4px;
  font-size: 0.85em;
}

/* ============================================================
   ROUND HEADER
   ============================================================ */
.round-header {
  margin-bottom: 1.4rem;
  animation: fadeUp 0.3s ease both;
}
.round-header h1 { margin-bottom: 0.6rem; }
.round-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   ROUND BIDS
   ============================================================ */
.page-round-bids { max-width: 700px; margin: 0 auto; }

.bid-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.95rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-2);
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-body);
}
.bid-total-bar strong {
  font-family: var(--font-mono);
  color: var(--gold);
}

.dealer-warning {
  background: rgba(224, 48, 80, 0.12);
  border: 1px solid rgba(224, 48, 80, 0.4);
  border-radius: 100px;
  padding: 0.25rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--crimson);
}

.bids-table {
  width: 100%;
  border-collapse: collapse;
}
.bids-table th,
.bids-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.bids-table th {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-body);
}
.bid-row:hover { background: rgba(255, 255, 255, 0.015); }
.dealer-row { background: rgba(201, 168, 76, 0.04); }

.order-cell {
  color: var(--text-3);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.name-cell {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
}
.role-cell { }
.bid-col { width: 110px; }

.bid-input {
  width: 80px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 1.05rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bid-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}
.bid-input.bid-forbidden {
  border-color: rgba(224, 48, 80, 0.7);
  background: rgba(224, 48, 80, 0.08);
  box-shadow: 0 0 0 3px rgba(224, 48, 80, 0.12);
}

/* ============================================================
   ROUND RESULTS
   ============================================================ */
.page-round-results { max-width: 700px; margin: 0 auto; }

.tricks-total-bar {
  padding: 0.7rem 0.95rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tricks-total-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
}
.tricks-total-bar.total-ok .tricks-total-value   { color: var(--emerald); }
.tricks-total-bar.total-over .tricks-total-value { color: var(--crimson); }

.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th,
.results-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.results-table th {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-body);
}
.result-row:hover { background: rgba(255, 255, 255, 0.015); }

.bid-display {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-1);
  text-align: center;
}
.tricks-col { width: 110px; }

.tricks-input {
  width: 80px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 1.05rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tricks-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}

.preview-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
}
.preview-delta   { color: var(--text-3); }
.preview-positive { color: var(--emerald); }
.preview-negative { color: var(--crimson); }
.preview-zero     { color: var(--slate); }

/* ============================================================
   ROUND SUMMARY
   ============================================================ */
.page-round-summary { max-width: 900px; margin: 0 auto; }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.delta-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

.delta-card {
  padding: 1.1rem 0.9rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.delta-card.delta-positive {
  background: rgba(52, 208, 116, 0.07);
  border-color: rgba(52, 208, 116, 0.3);
  box-shadow: 0 0 16px rgba(52, 208, 116, 0.08);
}
.delta-card.delta-negative {
  background: rgba(224, 48, 80, 0.07);
  border-color: rgba(224, 48, 80, 0.3);
  box-shadow: 0 0 16px rgba(224, 48, 80, 0.08);
}
.delta-card.delta-zero {
  background: rgba(107, 114, 128, 0.06);
  border-color: rgba(107, 114, 128, 0.2);
}

.delta-player-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.delta-value {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.delta-positive .delta-value { color: var(--emerald); }
.delta-negative .delta-value { color: var(--crimson); }
.delta-zero     .delta-value { color: var(--slate); }

.delta-detail {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.4rem;
}

.hit-badge {
  color: var(--emerald);
  margin-left: 4px;
  font-weight: 700;
}

/* Leaderboard table */
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th,
.leaderboard-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.leaderboard-table th {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-body);
}
.rank-col { width: 50px; text-align: center; }
.score-col {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}
.rank-first { background: rgba(201, 168, 76, 0.07); }
.rank-first td { color: var(--gold); }

.summary-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* ============================================================
   GAME COMPLETE
   ============================================================ */
.page-complete { max-width: 900px; margin: 0 auto; }

.complete-hero {
  position: relative;
  text-align: center;
  padding: 2.5rem 1.5rem;
  margin-bottom: 1.75rem;
  background: rgba(17, 17, 24, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  overflow: hidden;
}

/* Art deco inner frame for complete hero */
.complete-hero::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: calc(var(--radius-xl) - 2px);
  pointer-events: none;
}

.complete-hero h1 {
  font-size: 2.75rem;
  display: inline-block;
}

.winner-announcement { margin: 1.75rem 0 1rem; }
.winner-crown { font-size: 4rem; line-height: 1; }
.winner-name {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  display: inline-block;
  margin: 0.5rem 0 0.25rem;
}
.winner-score {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-2);
}
.winner-announcement.tie .winner-names span {
  display: inline-block;
  margin: 0 0.4rem;
  color: var(--gold);
  font-size: 1.5rem;
  font-family: var(--font-display);
  font-weight: 600;
}

.game-duration {
  color: var(--text-3);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.final-standings,
.full-breakdown { margin-bottom: 1.5rem; }

.standings-table { width: 100%; border-collapse: collapse; }
.standings-table th,
.standings-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.standings-table th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-3);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: var(--font-body);
}
.rank-winner { background: rgba(201, 168, 76, 0.07); }
.rank-winner td { color: var(--gold); }
.rank-winner .score-col strong { color: var(--gold-shine); font-family: var(--font-mono); }

.complete-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-bottom: 2rem;
}

/* ============================================================
   HISTORY
   ============================================================ */
.page-history       { max-width: 800px; margin: 0 auto; }
.page-history-game  { max-width: 1000px; margin: 0 auto; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: block;
  padding: 1.1rem 1.375rem;
  color: var(--text-1);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}
.history-item:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), var(--shadow-gold);
  text-decoration: none;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.history-date {
  color: var(--text-3);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.history-winner {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
}

.history-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.history-player-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  font-family: var(--font-body);
}

.history-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3);
}
.history-score-item { }

.empty-state .card-body { padding: 3rem; text-align: center; }

.history-winner-card { margin-bottom: 1.5rem; }
.history-winner-card .card-body { padding: 2rem; }
.history-winner-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  display: inline-block;
  margin: 0.5rem 0 0.3rem;
}
.history-winner-score {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-2);
}

/* ============================================================
   ADMIN
   ============================================================ */
.page-admin { max-width: 600px; margin: 0 auto; }

.admin-player-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-player-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 1rem;
}

.admin-info { margin-top: 1.5rem; }

.code-block {
  display: block;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--emerald);
  margin-top: 0.5rem;
  overflow-x: auto;
  white-space: pre;
}

/* ============================================================
   SCORE DELTA BACKGROUND CELLS (RESULTS/BIDS PREVIEW)
   ============================================================ */

/* Reusable coloured preview spans in results table */
.tricks-status { font-family: var(--font-mono); font-size: 0.85rem; }

/* ============================================================
   UTILITIES
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   RESPONSIVE — TABLET (768px)
   ============================================================ */
@media (min-width: 769px) {
  .main-content { padding: 2.25rem 2rem; }
}

/* ============================================================
   RESPONSIVE — MOBILE (max 640px)
   ============================================================ */
@media (max-width: 640px) {
  .main-content { padding: 1.25rem 1rem; }

  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.25rem; }

  .home-title { font-size: 2.4rem; }
  .complete-hero h1 { font-size: 2rem; }
  .winner-name { font-size: 1.8rem; }
  .delta-value { font-size: 2.4rem; }

  .nav-inner { padding: 0 0.9rem; }
  .nav-brand { font-size: 1.25rem; }
  .nav-link { padding: 0.28rem 0.55rem; font-size: 0.78rem; }

  .page-header { flex-direction: column; gap: 0.75rem; }
  .page-header-actions { align-self: stretch; }
  .page-header-actions .btn { width: 100%; }

  .summary-grid { grid-template-columns: 1fr; }

  .home-links { grid-template-columns: 1fr 1fr; }

  .card-body { padding: 1rem; }
  .card-header { padding: 0.85rem 1rem; }
  .card-footer { padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .card-footer .btn { flex: 1; min-width: 100px; }

  .btn-lg { padding: 0.65rem 1.4rem; font-size: 0.95rem; }

  .admin-player-row { grid-template-columns: 90px 1fr; gap: 0.6rem; }

  .login-card { padding: 2rem 1.5rem; }
  .login-logo h1 { font-size: 2.4rem; }

  .complete-hero { padding: 1.75rem 1rem; }

  .round-meta { gap: 0.4rem; }
  .meta-badge { font-size: 0.8rem; padding: 0.25rem 0.65rem; }

  /* Scorecard scrolls horizontally */
  .scorecard-wrapper { border-radius: var(--radius-md); }
  .scorecard-table { font-size: 0.8rem; }
  .scorecard-table thead th { padding: 0.6rem 0.4rem; font-size: 0.72rem; }
  .score-cell { padding: 0.25rem 0.3rem; }
  .cell-delta { font-size: 0.85rem; }

  .bid-input,
  .tricks-input { width: 70px; font-size: 0.95rem; }
}

/* ============================================================
   RESPONSIVE — VERY SMALL (max 480px)
   ============================================================ */
@media (max-width: 480px) {
  .nav-link { display: none; }
  .nav-link.nav-active-game,
  .nav-link.nav-logout { display: flex; }
  .nav-links { gap: 0.1rem; }

  .home-links { grid-template-columns: 1fr; }

  .delta-cards { grid-template-columns: 1fr 1fr; }
}
