*{box-sizing:border-box}

:root{
  --bg1:#2b0a57;
  --bg2:#4c1d95;
  --bg3:#7c3aed;

  --card:#fffaf0;
  --card2:#ffffff;
  --text:#2b2140;
  --muted:#6d6482;
  --border:#e7d7a8;

  --gold:#d4af37;
  --gold2:#f4d77b;

  --purple:#6d28d9;
  --purple-dark:#4c1d95;

  --red:#c63b3b;
  --green:#2f8f4e;
  --blue:#2563eb;
  --teal:#0f766e;
  --orange:#d97706;

  --danger:#b42318;
}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.10), transparent 24%),
    radial-gradient(circle at top right, rgba(255,215,100,.10), transparent 22%),
    linear-gradient(145deg,var(--bg1),var(--bg2) 48%,var(--bg3));
}

body{
  min-height:100vh;
}

button,input,select{
  font:inherit;
}

button{
  cursor:pointer;
}

.app{
  max-width:920px;
  margin:0 auto;
  padding:16px 12px 38px;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  padding:14px 16px;
  border:2px solid rgba(255,255,255,.18);
  border-radius:22px;
  background:rgba(255,255,255,.10);
  backdrop-filter:blur(6px);
  box-shadow:0 10px 28px rgba(0,0,0,.12);
}

.eyebrow{
  font-size:.74rem;
  font-weight:900;
  letter-spacing:.22em;
  color:#f8e38b;
  text-transform:uppercase;
}

h1{
  margin:4px 0 0;
  font-size:2rem;
  line-height:1.05;
  font-weight:900;
  color:#fff8dc;
  text-shadow:0 2px 10px rgba(0,0,0,.25);
}

.subhead{
  margin-top:8px;
  color:rgba(255,255,255,.86);
  font-weight:700;
  font-size:.96rem;
}

h2{
  margin:0 0 10px;
  font-size:1.2rem;
  font-weight:900;
  color:var(--purple-dark);
}

.card{
  background:linear-gradient(180deg,var(--card2),var(--card));
  border:2px solid var(--border);
  border-radius:22px;
  padding:16px;
  margin-bottom:14px;
  box-shadow:
    0 10px 24px rgba(14,10,30,.12),
    inset 0 1px 0 rgba(255,255,255,.9);
}

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

.row input{
  flex:1;
  min-width:0;
}

input,select{
  width:100%;
  min-height:48px;
  border:2px solid #e4d8f8;
  border-radius:14px;
  padding:10px 12px;
  background:#fff;
  color:var(--text);
  font-size:16px;
  box-shadow:inset 0 1px 3px rgba(20,20,30,.05);
}

input:focus,select:focus,button:focus-visible{
  outline:3px solid rgba(124,58,237,.25);
  outline-offset:1px;
}

button{
  min-height:46px;
  border:0;
  border-radius:14px;
  padding:10px 15px;
  font-weight:850;
  transition:transform .08s ease, box-shadow .12s ease, opacity .12s ease;
}

button:hover{
  transform:translateY(-1px);
}

button:active{
  transform:translateY(0);
}

button:disabled{
  opacity:.6;
  cursor:not-allowed;
  transform:none;
}

.primary{
  color:#fff;
  background:linear-gradient(180deg,#8b5cf6,#6d28d9 60%,#5b21b6);
  box-shadow:0 8px 18px rgba(109,40,217,.28);
}

.secondary{
  color:var(--purple-dark);
  background:linear-gradient(180deg,#fff4c5,#f6df8c);
  box-shadow:0 4px 12px rgba(212,175,55,.18);
}

.wide{
  width:100%;
  margin-top:12px;
}

.muted{
  color:var(--muted);
}

.light{
  color:rgba(255,255,255,.88);
}

.small{
  font-size:.88rem;
}

.message{
  min-height:20px;
  margin-top:10px;
  font-size:.92rem;
  color:var(--danger);
  font-weight:700;
}

.field{
  display:block;
  margin-top:14px;
  font-weight:850;
}

.field span{
  display:block;
  margin-bottom:6px;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:7px;
  border-radius:999px;
  padding:7px 12px;
  font-weight:900;
  color:#fff;
  box-shadow:0 4px 10px rgba(0,0,0,.10);
}

.chip button{
  min-height:auto;
  padding:0 4px;
  background:none;
  color:rgba(255,255,255,.95);
  font-size:1.22rem;
  line-height:1;
}

#playerChips .chip:nth-child(5n+1){background:linear-gradient(180deg,#d34b4b,#b42318)}
#playerChips .chip:nth-child(5n+2){background:linear-gradient(180deg,#389e58,#207744)}
#playerChips .chip:nth-child(5n+3){background:linear-gradient(180deg,#3b82f6,#1d4ed8)}
#playerChips .chip:nth-child(5n+4){background:linear-gradient(180deg,#0ea5a4,#0f766e)}
#playerChips .chip:nth-child(5n+5){background:linear-gradient(180deg,#e6a318,#c97a00)}

.hidden{
  display:none!important;
}

.hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.18), transparent 28%),
    linear-gradient(145deg,#5b21b6,#7c3aed 55%,#8b5cf6);
  color:#fff;
  border:2px solid #e8c766;
  box-shadow:
    0 12px 26px rgba(49,12,107,.28),
    inset 0 1px 0 rgba(255,255,255,.18);
}

.hero-left,.hero-right{
  display:flex;
  flex-direction:column;
}

.hero-right{
  align-items:flex-end;
}

.hand-card-wrap{
  margin:6px 0 4px;
}

.big-hand{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:96px;
  min-height:96px;
  padding:8px 16px;
  font-size:3.2rem;
  font-weight:1000;
  line-height:1;
  color:var(--purple-dark);
  background:linear-gradient(180deg,#fffef9,#fff2c5);
  border:3px solid #f0d67a;
  border-radius:20px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 10px 20px rgba(0,0,0,.14);
}

.dealer-line{
  display:flex;
  align-items:center;
  gap:8px;
  margin:4px 0 2px;
}

.crown-icon{
  font-size:1.25rem;
}

.dealer-name{
  font-size:1.42rem;
  font-weight:1000;
  color:#fff8dc;
}

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.round-tracker{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.round-pill{
  min-width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 10px;
  border-radius:999px;
  border:2px solid #e9dbad;
  font-weight:900;
  background:#fff;
  color:var(--purple-dark);
  box-shadow:0 2px 5px rgba(20,20,30,.05);
}

.round-pill.done{
  background:linear-gradient(180deg,#fff4c5,#f6df8c);
  color:#6f4f00;
  border-color:#e6c45c;
}

.round-pill.current{
  background:linear-gradient(180deg,#8b5cf6,#6d28d9);
  color:#fff;
  border-color:#cdb5fb;
  box-shadow:0 8px 18px rgba(109,40,217,.22);
  transform:translateY(-1px);
}

.round-pill.future{
  opacity:.9;
}

.score-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.score-box{
  padding:12px;
  border:2px solid #efe4b8;
  border-radius:18px;
  background:linear-gradient(180deg,#fffdf7,#fff8e7);
}

.score-box label{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:7px;
  font-weight:900;
  color:var(--purple-dark);
}

.dealer-badge{
  font-size:.72rem;
  color:#7a5200;
  background:linear-gradient(180deg,#fff4c5,#f6df8c);
  border:1px solid #e2bf56;
  padding:3px 8px;
  border-radius:999px;
  font-weight:900;
}

.actions{
  display:flex;
  gap:9px;
  margin-top:13px;
}

.actions button:first-child{
  flex:1;
}

.edit-meta{
  margin-bottom:10px;
  font-weight:700;
}

.standings{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}

.standing-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-radius:16px;
  padding:12px 13px;
  color:#fff;
  box-shadow:0 6px 12px rgba(0,0,0,.08);
}

.standing-left{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.standing-name{
  font-weight:900;
}

.standing-note{
  font-size:.8rem;
  opacity:.95;
}

.standing-score{
  font-weight:1000;
  font-size:1.3rem;
}

#standings .standing-row:nth-child(5n+1){background:linear-gradient(135deg,#6d28d9,#4c1d95)}
#standings .standing-row:nth-child(5n+2){background:linear-gradient(135deg,#2f8f4e,#1f6d39)}
#standings .standing-row:nth-child(5n+3){background:linear-gradient(135deg,#c63b3b,#9f1d1d)}
#standings .standing-row:nth-child(5n+4){background:linear-gradient(135deg,#0f766e,#155e75)}
#standings .standing-row:nth-child(5n+5){background:linear-gradient(135deg,#d97706,#b45309)}

.link-btn{
  background:none;
  color:var(--purple);
  padding:4px 6px;
  min-height:36px;
  font-weight:900;
}

.history-wrap{
  overflow-x:auto;
  margin-top:8px;
  border:2px solid #efe4b8;
  border-radius:16px;
  background:#fffef9;
}

table{
  border-collapse:collapse;
  width:100%;
  min-width:720px;
}

th,td{
  padding:10px 11px;
  border-bottom:1px solid #efe4b8;
  text-align:center;
  white-space:nowrap;
}

thead th{
  background:linear-gradient(180deg,#6d28d9,#5b21b6);
  color:#fff;
  font-weight:900;
}

th:first-child,td:first-child{
  text-align:left;
}

tbody tr:nth-child(even){
  background:#fffaf0;
}

tfoot td{
  font-weight:1000;
  background:#fff6d8;
  color:var(--purple-dark);
}

.table-edit-btn{
  min-height:34px;
  padding:6px 10px;
  font-size:.88rem;
  border-radius:10px;
}

.finish-title{
  font-size:1.8rem;
  font-weight:1000;
  text-align:center;
  color:var(--purple-dark);
}

.winner{
  text-align:center;
  font-size:1.18rem;
  margin:8px 0 14px;
  font-weight:900;
  color:#7a5200;
}

.podium{
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:12px;
  margin-top:8px;
  flex-wrap:wrap;
}

.podium-slot{
  min-width:140px;
  text-align:center;
  border-radius:18px 18px 12px 12px;
  padding:12px 12px 10px;
  color:#fff;
  box-shadow:0 10px 18px rgba(0,0,0,.10);
}

.podium-slot .place{
  font-size:.84rem;
  font-weight:900;
  opacity:.95;
  letter-spacing:.06em;
}

.podium-slot .podium-name{
  font-size:1.08rem;
  font-weight:1000;
  margin-top:4px;
}

.podium-slot .podium-score{
  font-size:.95rem;
  font-weight:800;
  margin-top:6px;
}

.podium-slot.first{
  min-height:190px;
  background:linear-gradient(180deg,#f7d977,#d4af37);
  color:#5b4300;
  order:2;
}

.podium-slot.second{
  min-height:150px;
  background:linear-gradient(180deg,#bcc6d5,#8b98ad);
  order:1;
}

.podium-slot.third{
  min-height:125px;
  background:linear-gradient(180deg,#d39c74,#b87333);
  order:3;
}

.finish-actions{
  justify-content:center;
}

.finish-actions button{
  flex:0 0 auto!important;
  min-width:180px;
}

.empty-note{
  color:var(--muted);
  font-weight:700;
}

@media(max-width:700px){
  .standings,.score-grid{
    grid-template-columns:1fr;
  }

  .hero{
    align-items:flex-start;
    flex-direction:column;
  }

  .hero-right{
    align-items:flex-start;
  }
}

@media(max-width:560px){
  .app{
    padding:12px 10px 30px;
  }

  .topbar{
    align-items:flex-start;
    flex-direction:column;
  }

  h1{
    font-size:1.65rem;
  }

  .actions{
    flex-direction:column;
  }

  .big-hand{
    min-width:82px;
    min-height:82px;
    font-size:2.7rem;
  }

  .podium{
    flex-direction:column;
    align-items:stretch;
  }

  .podium-slot.first,
  .podium-slot.second,
  .podium-slot.third{
    order:initial;
    min-height:auto;
  }
}
