:root {
  --felt: #0b3a2c;
  --felt-dark: #072018;
  --felt-deep: #04130d;
  --gold: #d4af37;
  --gold-bright: #f3cf5b;
  --gold-deep: #9a7b22;
  --ivory: #f5efe0;
  --ivory-dim: #cdbfa0;
  --crimson: #9c1f1f;
  --crimson-bright: #c5392f;
  --black: #0a0a0a;
  --line: rgba(212, 175, 55, 0.32);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  --radius: 12px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ivory);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.5;
  padding: 0 0 88px;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(212, 175, 55, 0.10), transparent 70%),
    radial-gradient(120% 90% at 50% -5%, #11503c 0%, var(--felt) 42%, var(--felt-dark) 72%, var(--felt-deep) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

/* felt texture + vignette */
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 4px),
    radial-gradient(120% 80% at 50% 35%, transparent 38%, rgba(0,0,0,0.6) 100%);
  opacity: 0.5;
}

/* ---------- Player card (topo) ---------- */
.player-card {
  position: relative; z-index: 2;
  margin: 18px auto 6px; max-width: 1040px;
  background: linear-gradient(180deg, #12100c, #0b0c08);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(212,175,55,0.12);
  padding: 26px 24px 18px;
}
.player-card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(212,175,55,0.18); border-radius: 8px; pointer-events: none;
}
.brand {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 0.82rem;
  letter-spacing: 0.34em; color: var(--gold-bright);
  background: linear-gradient(180deg, #12100c, #0b0c08);
  padding: 2px 16px; border: 1px solid var(--gold); border-radius: 999px;
  text-shadow: 0 0 12px rgba(243,207,91,0.5);
}
.pc-info { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.pc-label {
  font-family: "Space Mono", monospace; font-size: 0.62rem;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--ivory-dim);
}
.pc-name {
  font-family: "Playfair Display", serif; font-weight: 700;
  font-size: 2rem; color: var(--ivory); letter-spacing: 0.01em;
}
.pc-points {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  width: 88px; height: 88px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, #c5392f 0%, var(--crimson) 55%, #6e1313 100%);
  border: 3px dashed var(--gold-bright);
  box-shadow: 0 0 0 4px #0a0a0a, 0 8px 20px rgba(0,0,0,0.5);
}
.pc-points .pc-label { color: #f3d9b0; }
.pc-value {
  font-family: "Playfair Display", serif; font-weight: 900;
  font-size: 1.9rem; color: var(--ivory); line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ---------- GM panel ---------- */
.gm-panel {
  position: relative; z-index: 2;
  max-width: 1040px; margin: 18px auto 0; padding: 18px 22px;
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  background: linear-gradient(180deg, rgba(20,16,9,0.97), rgba(10,9,5,0.98));
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(212,175,55,0.1);
}
.gm-panel[hidden] { display: none; }
.gm-copy { min-width: 0; }
.gm-kicker {
  font-family: "Space Mono", monospace; font-size: 0.62rem;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold-bright);
}
.gm-copy h2 {
  font-family: "Playfair Display", serif; font-weight: 700;
  font-size: 1.35rem; color: var(--ivory); margin: 2px 0 4px;
}
.gm-copy p { color: var(--ivory-dim); font-size: 0.98rem; }
.gm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.gm-actions .btn { width: auto; padding: 10px 14px; font-size: 0.88rem; }
.btn-danger {
  color: #ffd9c9; background: linear-gradient(180deg, #a92c1f, #6e1313);
  border: 1px solid #d98b3a;
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 0 18px rgba(197,57,47,0.45); }

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 2;
  max-width: 1040px; margin: 14px auto 0; padding: 0 18px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(8,28,20,0.96), rgba(5,16,11,0.97));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px 26px;
  box-shadow: var(--shadow);
}
/* deco corner accents */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none;
  border-color: var(--gold); border-style: solid;
}
.panel::before { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.panel::after { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.panel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.panel-kicker {
  font-family: "Playfair Display", serif; font-weight: 900; color: var(--gold-bright);
  font-size: 1.5rem; text-shadow: 0 0 10px rgba(243,207,91,0.35);
}
.panel-head h2 {
  font-family: "Playfair Display", serif; font-weight: 700;
  font-size: 1.5rem; letter-spacing: 0.02em; color: var(--ivory);
}
.panel-head h2::after {
  content: ""; display: block; height: 1px; margin-top: 4px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.lede { color: var(--ivory-dim); font-style: italic; margin-bottom: 14px; }
.conn-status { color: var(--ivory-dim); font-style: italic; font-size: 0.95rem; margin-top: 10px; }

/* ---------- Forms / inputs ---------- */
input, select {
  width: 100%; font-family: "Cormorant Garamond", serif; font-size: 1.05rem;
  color: var(--ivory); background: #06120c;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: rgba(205,191,160,0.45); }
input:focus, select:focus {
  outline: none; border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.2);
}
.select { margin: 6px 0 12px; }

/* ---------- Buttons (fichas) ---------- */
.btn {
  font-family: "Playfair Display", serif; font-weight: 700; letter-spacing: 0.03em;
  font-size: 0.95rem; cursor: pointer; border: none; border-radius: 999px;
  padding: 12px 18px; transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; filter: grayscale(0.4); }
.btn-gold {
  color: #2a1c05;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  box-shadow: 0 6px 18px rgba(212,175,55,0.35), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-gold:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(243,207,91,0.5), inset 0 1px 0 rgba(255,255,255,0.6); }
.btn-line {
  color: var(--gold-bright); background: transparent;
  border: 1.5px solid var(--gold); width: 100%;
}
.btn-line:hover:not(:disabled) { background: rgba(212,175,55,0.14); box-shadow: 0 0 16px rgba(212,175,55,0.25); }
.btn-ghost {
  color: var(--ivory-dim); background: transparent;
  border: 1px solid var(--line); white-space: nowrap;
}
.btn-ghost:hover { color: var(--ivory); border-color: var(--gold); }

/* ---------- Register / player ---------- */
.register form { display: flex; flex-direction: column; gap: 12px; }
.action-row { display: flex; gap: 10px; margin-bottom: 14px; }
.action-row .btn-gold { flex: 1; }
.point-add { display: flex; gap: 10px; margin-bottom: 20px; }
.point-add input { max-width: 120px; }
.point-add .btn { white-space: nowrap; }
.subhead {
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 1.05rem;
  color: var(--gold-bright); letter-spacing: 0.05em;
  border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 12px;
}

/* ---------- Deck grid (cartas de jogo) ---------- */
.deck-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.card {
  position: relative; aspect-ratio: 3/4.4; border-radius: 9px;
  background: linear-gradient(160deg, #fbf6ea, #ece2c9);
  color: #1b1208; border: 1px solid var(--gold-deep);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.5), inset 0 0 0 4px rgba(212,175,55,0.35), 0 6px 14px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 9px 8px; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-5px) rotate(-1.5deg); box-shadow: inset 0 0 0 4px rgba(212,175,55,0.5), 0 14px 26px rgba(0,0,0,0.55), 0 0 22px rgba(212,175,55,0.35); }
/* canto de carta de baralho */
.card .num {
  font-family: "Space Mono", monospace; font-size: 0.6rem;
  color: var(--crimson); letter-spacing: 0.08em; font-weight: 700;
}
.card .cname {
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 0.95rem;
  line-height: 1.12; text-align: center; color: #1b1208;
}
.card .rule {
  height: 1px; background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
  margin: 2px 0;
}
.card::after {
  content: "♢"; position: absolute; bottom: 6px; right: 8px;
  color: var(--crimson); font-size: 0.8rem;
}
.empty-note { color: var(--ivory-dim); font-style: italic; margin-top: 8px; }

/* ---------- Trade panel ---------- */
.field-label {
  font-family: "Space Mono", monospace; font-size: 0.66rem;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-bright);
}
.trade-modes { display: flex; flex-direction: column; gap: 14px; }
.trade-mode {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px 16px; background: rgba(0,0,0,0.28);
}
.trade-mode h3 {
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 1.1rem;
  color: var(--ivory); margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.mode-no { color: var(--gold-bright); text-shadow: 0 0 8px rgba(243,207,91,0.4); }
.mode-desc { color: var(--ivory-dim); font-size: 1rem; margin-bottom: 10px; }
.mode-desc strong { color: var(--gold-bright); }
.mini-input { margin-bottom: 10px; }

/* ---------- Roster footer ---------- */
.roster-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(7,32,24,0.92), rgba(4,16,11,0.96));
  border-top: 1px solid var(--gold); backdrop-filter: blur(6px);
}
.roster-title {
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 0.9rem;
  color: var(--gold-bright); letter-spacing: 0.12em; white-space: nowrap;
}
.roster-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.roster-list li {
  font-size: 0.98rem; color: var(--ivory);
  padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(212,175,55,0.08);
}
.roster-list li::before { content: "♢ "; color: var(--gold-bright); font-size: 0.75rem; }
.roster-empty { border: none !important; background: none !important; color: var(--ivory-dim); font-style: italic; }
.roster-empty::before { content: "" !important; }
.roster-list li.is-me { border-color: var(--gold); color: var(--gold-bright); background: rgba(243,207,91,0.14); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 5; color: #f6e6d6;
  border: 1px solid #d98b3a; border-radius: 10px;
  padding: 12px 18px; font-size: 1rem; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
  background: linear-gradient(180deg, #b8451f, #8a2417);
  animation: toast-in 0.25s ease;
}

/* ---------- Animations ---------- */
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

body.flash::after {
  content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(243,207,91,0.30), rgba(17,80,60,0.12) 45%, transparent 65%);
  animation: flash 0.9s ease forwards;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .player-card { margin: 14px 12px 4px; padding: 24px 16px 16px; }
  .pc-name { font-size: 1.5rem; }
  .pc-points { width: 70px; height: 70px; right: 12px; }
  .pc-value { font-size: 1.5rem; }
  .gm-panel { grid-template-columns: 1fr; margin: 14px 12px 0; padding: 16px; }
  .gm-actions { justify-content: stretch; }
  .gm-actions .btn { flex: 1; }
  .roster-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
