/* Logan Circle */
:root {
  --bg: #14171c;
  --bg2: #1c2129;
  --panel: #222936;
  --panel2: #2a3343;
  --ink: #e8e6df;
  --dim: #9aa3b2;
  --b-color: #4f9d69;
  --mi-color: #a05a7c;
  --accent: #d8b25a;
  --danger: #c4554d;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif; font-size: 14px; }
#app { min-height: 100vh; display: flex; flex-direction: column; }

h1 { font-weight: 800; letter-spacing: 0.18em; text-align: center; margin: 0.4em 0; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
b { color: var(--accent); }

/* ---------------- buttons ---------------- */
.btn { background: var(--panel2); color: var(--ink); border: 1px solid #3a4456;
  border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.btn:hover:not(:disabled) { background: #34405466; border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: #38507a; border-color: #4d6ba3; }
.btn.big { font-size: 17px; padding: 12px 26px; }

/* ---------------- landing / lobby ---------------- */
.landing, .lobby { max-width: 860px; margin: 6vh auto; padding: 24px; }
.landing { position: relative; }
.landing > *:not(.menufx) { position: relative; z-index: 1; }
.menufx { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.landing h1 { font-size: 44px; }
.tagline { text-align: center; line-height: 1.6; color: var(--dim); }
.landing-buttons { display: flex; gap: 16px; justify-content: center; margin: 32px 0; flex-wrap: wrap; }

/* deck browser */
.deck-browser { max-width: 1100px; margin: 0 auto; padding: 0 14px 30px; }
.deck-browser .center { text-align: center; }
.deck-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 18px; }
.deck-tab { background: var(--panel); color: var(--ink); border: 1px solid #3a4456;
  border-left: 5px solid var(--deck-color); border-radius: 6px; padding: 6px 12px;
  cursor: pointer; font-size: 13px; font-weight: 600; }
.deck-tab:hover { border-color: var(--deck-color); }
.deck-tab.active { background: var(--panel2); border-color: var(--deck-color);
  box-shadow: 0 0 10px #0006; outline: 1px solid var(--deck-color); }
.deck-blurb { background: var(--panel); border-radius: 8px; border-left: 5px solid var(--accent);
  padding: 10px 14px; margin: 0 auto 18px; max-width: 760px; font-size: 13px; line-height: 1.5; }
.browse-cards { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.browse-card { position: relative; }
.copies-badge { position: absolute; top: -7px; right: -7px; background: var(--panel2);
  border: 1px solid #3a4456; border-radius: 10px; padding: 1px 7px; font-size: 11px;
  font-weight: 700; color: var(--dim); }
.join-form { display: flex; flex-direction: column; gap: 12px; max-width: 320px; margin: 0 auto; }
input, select { background: var(--bg2); color: var(--ink); border: 1px solid #3a4456;
  border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.room-code { text-align: center; font-size: 18px; margin: 12px 0 20px; }
.room-code b { font-size: 26px; letter-spacing: 0.3em; color: var(--accent); }
.seat-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.seat-row { display: grid; grid-template-columns: 150px 145px 1fr 1.2fr 92px; gap: 10px;
  align-items: center; background: var(--panel); padding: 10px 14px; border-radius: 8px;
  border-left: 4px solid var(--b-color); }
@media (max-width: 920px) {
  .seat-row { grid-template-columns: 1fr 1fr; }
  .seat-row-id, .seat-row select[data-deck] { grid-column: 1 / -1; }
}
.seat-row.mi { border-left-color: var(--mi-color); }
.seat-row.mine { outline: 1px solid var(--accent); }
.seat-row-id { font-weight: 700; }
.settings-row { display: flex; gap: 24px; align-items: center; margin: 10px 0 18px; flex-wrap: wrap; }
.settings-row input { width: 64px; }
.lobby-buttons { display: flex; gap: 14px; }
.fail-box { background: var(--panel); border: 1px solid #5a2e2e; border-radius: 10px;
  padding: 16px 20px; max-width: 560px; margin: 0 auto 8px; }
.fail-title { font-weight: 700; font-size: 17px; color: #e8a3a3; margin-bottom: 8px; }
.fail-body { color: var(--dim); line-height: 1.6; text-align: left; }
.rules { margin-top: 26px; background: var(--panel); border-radius: 8px; padding: 10px 16px; }
.rules summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.rules li { margin: 6px 0; line-height: 1.5; color: var(--dim); }

/* ---------------- game layout ---------------- */
#topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg2); border-bottom: 1px solid #2e3744; padding: 8px 14px; position: sticky; top: 0; z-index: 5; }
.title-mini { font-weight: 800; letter-spacing: 0.2em; color: var(--dim); font-size: 12px; }
.turn-now { font-weight: 700; padding: 3px 10px; border-radius: 5px; background: #2c3a2e; }
.turn-now.mi { background: #3a2c34; }
.counters { display: flex; gap: 10px; }
.ctr { background: var(--panel); padding: 3px 8px; border-radius: 5px; font-size: 12px; }
.team-influence { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
.inf-bar { flex: 1; height: 12px; background: #5d3a52; border-radius: 6px; overflow: hidden; }
.inf-fill { height: 100%; background: var(--b-color); transition: width 0.7s cubic-bezier(0.25, 0.8, 0.3, 1); }
.inf-b { color: #7fd49a; font-weight: 700; display: inline-block; }
.inf-mi { color: #d490b4; font-weight: 700; display: inline-block; }
.inf-b.tick, .inf-mi.tick { animation: inftick 0.7s; }
@keyframes inftick { 30% { transform: scale(1.3); filter: brightness(1.6); } }
.cycle-banner { padding: 3px 10px; border-radius: 5px; font-weight: 700; }
.cycle-banner.mania { background: #6b3aa0; animation: pulse 1.2s infinite alternate; }
.cycle-banner.depression { background: #2c3e50; }
.lock-banner { background: #5a2e2e; padding: 3px 10px; border-radius: 5px; font-size: 12px; }
.lock-banner.regime { background: #3d3a5c; }
.echo-badge { font-size: 11px; color: #c79bf0; font-weight: 700; margin-top: 4px; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.35); } }

#table { display: flex; flex: 1; gap: 10px; padding: 10px; }
#side-left { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#side-right { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 56px; max-height: calc(100vh - 80px); align-self: flex-start; }

/* seats & boards */
.seat-panel { background: var(--panel); border-radius: 10px; padding: 8px;
  display: flex; gap: 10px; border: 1px solid transparent; }
.seat-panel.active { border-color: var(--accent); box-shadow: 0 0 14px #d8b25a33; }
.seat-panel.mi { border-left: 5px solid var(--mi-color); }
.seat-panel.b { border-left: 5px solid var(--b-color); flex: 1; min-width: 0; }
#b-row { display: flex; gap: 10px; }
.seat-info { width: 168px; flex-shrink: 0; }
.seat-name { font-weight: 700; }
.you-tag { background: var(--accent); color: #222; font-size: 10px; border-radius: 4px;
  padding: 1px 5px; vertical-align: middle; }
.seat-deck { font-size: 12px; font-weight: 600; margin: 2px 0; }
.seat-stats { display: flex; gap: 8px; font-size: 12px; color: var(--dim); flex-wrap: wrap; }
.chip { color: var(--accent); font-weight: 700; }
.discard-link { cursor: pointer; text-decoration: underline dotted; }
.locked-out { font-size: 11px; color: var(--danger); margin-top: 4px; }
.direct-hint { margin-top: 6px; font-size: 12px; color: #ffb4a8; font-weight: 700; }
.seat-info.targetable { outline: 2px dashed var(--danger); border-radius: 6px; cursor: crosshair; }

.board { display: flex; gap: 8px; flex: 1; align-items: stretch; min-height: 86px; flex-wrap: wrap; }
.fighter-slot.empty { width: 110px; border: 1px dashed #39424f; border-radius: 8px; opacity: 0.5; }
.discard-pile { width: 84px; background: repeating-linear-gradient(135deg, #1b202a, #1b202a 6px, #20262f 6px, #20262f 12px);
  border: 2px solid #39424f; border-radius: 8px; padding: 6px; cursor: pointer; margin-left: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.discard-pile:hover { border-color: var(--accent); }
.discard-pile.empty { opacity: 0.45; cursor: default; }
.discard-pile .dp-label { font-size: 8px; letter-spacing: 0.18em; color: var(--dim); }
.discard-pile .dp-count { font-size: 20px; font-weight: 800; color: var(--accent); }
.discard-pile .dp-top { font-size: 9px; text-align: center; line-height: 1.2; color: #b9c0cc;
  max-height: 22px; overflow: hidden; }

/* End Turn emphasis: glow on your turn, pulse when nothing is left to do */
.btn.your-turn { border-color: var(--accent); box-shadow: 0 0 8px #d8b25a55; }
.btn.your-turn.done { animation: endpulse 1.1s ease-in-out infinite; }
@keyframes endpulse {
  0%, 100% { box-shadow: 0 0 6px #d8b25a55; }
  50% { box-shadow: 0 0 16px #d8b25acc; border-color: #ffe08a; }
}
.fighter { width: 110px; background: var(--panel2); border-radius: 8px; padding: 6px;
  position: relative; border: 2px solid #39424f; cursor: default; display: flex;
  flex-direction: column; justify-content: space-between; }
.fighter .f-name { font-size: 11.5px; font-weight: 600; line-height: 1.25;
  border-left: 3px solid; padding-left: 5px; }
.fighter .f-stats { font-size: 16px; font-weight: 800; text-align: right; }
.fighter .f-stats .atk { color: #e8b04b; }
.fighter .f-stats .hp { color: #6fcf7f; }
.fighter .f-stats .hp.hurt { color: var(--danger); }
.fighter .f-tag { position: absolute; top: 3px; right: 5px; font-size: 10px; color: var(--dim); }
.fighter.sick { opacity: 0.75; }
.fighter.can-attack { border-color: #d8b25a; cursor: pointer; }
.fighter.can-attack:hover { box-shadow: 0 0 10px #d8b25a66; }
.fighter.selected { border-color: #fff; box-shadow: 0 0 12px #ffffff88; }
.fighter.targetable { border-color: var(--danger); cursor: crosshair; box-shadow: 0 0 10px #c4554d88; }

/* center strip */
#center-strip { display: flex; gap: 16px; align-items: center; justify-content: center;
  background: #1a1f27; border-radius: 10px; padding: 8px; }
.center-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.zone-label { font-size: 11px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
.cycle-coin { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; text-align: center; font-weight: 800; font-size: 12px; border: 4px solid var(--accent); }
.cycle-coin.mania { background: #6b3aa0; }
.cycle-coin.depression { background: #2c3e50; }

/* cards */
.card { width: 168px; min-height: 104px; background: var(--panel2); border-radius: 8px;
  border: 2px solid #39424f; border-top: 6px solid var(--deck-color, #555);
  padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.card.empty { align-items: center; justify-content: center; color: var(--dim); border-top-width: 2px; }
.card.overridden { opacity: 0.6; }
.card .c-head { display: flex; justify-content: space-between; gap: 4px; }
.card .c-art { margin: 2px -2px; }
.card .c-art img { display: block; width: 100%; height: 58px; object-fit: cover; border-radius: 4px; }
.card .c-name { font-weight: 700; font-size: 12.5px; line-height: 1.2; }
.card .mark { color: var(--accent); }
.card .c-text { font-size: 10.5px; line-height: 1.35; color: #c7cdd8; flex: 1; overflow-y: auto; max-height: 110px; }
.card .c-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.card .c-stats { font-weight: 800; color: var(--ink); }
.card.hand, .card.modal { cursor: default; }
.card.playable { border-color: #6fcf7f; cursor: pointer; }
.card.playable:hover { transform: translateY(-6px); box-shadow: 0 6px 14px #000a; transition: 0.12s; }
.card.selectable { cursor: pointer; }
.card.selectable:hover { border-color: var(--accent); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 10px #d8b25a88; transform: translateY(-4px); }
.card.center { width: 190px; }

/* hands */
#hand-area { display: flex; flex-direction: column; gap: 8px; }
.hand-block { background: var(--panel); border-radius: 10px; padding: 8px; }
.hand-block.revealed { opacity: 0.92; border: 1px dashed #6b5a7a; }
.hand-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.hand-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

/* log */
#log-panel { background: var(--panel); border-radius: 10px; display: flex;
  flex-direction: column; flex: 7; min-height: 0; }

/* chat (the panel itself is created once by ui.js and survives re-renders) */
#chat-panel { background: var(--panel); border-radius: 10px; display: flex;
  flex-direction: column; flex: 3; min-height: 110px; }
#chat-scroll { flex: 1; overflow-y: auto; padding: 8px 12px; }
.chat-line { font-size: 12px; line-height: 1.4; margin-bottom: 4px; color: #c5ccd8; overflow-wrap: anywhere; }
.chat-name.b { color: #7fd49a; }
.chat-name.mi { color: #d490b4; }
#chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #2e3744; }
#chat-input { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12px; }
#chat-form .btn { padding: 4px 10px; font-size: 12px; }
.log-title { padding: 8px 12px; font-weight: 700; letter-spacing: 0.1em; font-size: 12px;
  color: var(--dim); border-bottom: 1px solid #2e3744; }
#log-scroll { overflow-y: auto; padding: 8px 12px; flex: 1; }
.log-line { font-size: 12px; line-height: 1.45; margin-bottom: 5px; color: #b9c0cc; }
.log-line.turn { color: var(--accent); font-weight: 700; margin-top: 8px; }
.log-line.influence { color: #8fd6a0; }
.log-line.attack { color: #e8a3a3; }
.log-line.death { color: #d77; }
.log-line.event { color: #e8c47b; font-weight: 600; }
.log-line.env { color: #7bd0c9; font-weight: 600; }
.log-line.cycle { color: #c79bf0; font-weight: 700; }
.log-line.coin { color: #9ec3e8; }
.log-line.play { color: #e6e2d8; }
.log-line.gameover { color: var(--accent); font-weight: 800; font-size: 14px; }

/* prompts */
.modal-back { position: fixed; inset: 0; background: #000a; display: flex; align-items: center;
  justify-content: center; z-index: 50; }
.modal { background: var(--bg2); border: 1px solid #3a4456; border-radius: 12px; padding: 20px;
  max-width: 520px; width: 92%; max-height: 86vh; overflow-y: auto; }
.modal.wide { max-width: 880px; }
.modal-for { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.modal-body { color: var(--dim); margin-bottom: 12px; line-height: 1.5; }
.modal-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.modal-opts .btn.opt { text-align: left; }
.modal-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.modal.winner { text-align: center; }
.modal.winner .modal-title { font-size: 26px; }
.waiting-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--accent); color: var(--ink);
  padding: 8px 18px; border-radius: 20px; z-index: 40; }

/* sound control */
#sound-control { position: fixed; bottom: 14px; left: 14px; z-index: 70; display: flex;
  align-items: center; gap: 6px; background: #1c2129cc; border: 1px solid #3a4456;
  border-radius: 18px; padding: 4px 10px; backdrop-filter: blur(4px); }
#sound-control button { background: none; border: none; font-size: 16px; cursor: pointer; padding: 2px; }
#sound-control input[type="range"] { width: 70px; accent-color: var(--accent); }

/* played-card showcase */
.showcase-layer { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; pointer-events: none;
  animation: showcase-in 0.25s ease-out; }
.showcase-layer.leaving { opacity: 0; transition: opacity 0.4s; }
.showcase-who { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); text-shadow: 0 2px 8px #000; }
.showcase-layer .card.showcase { width: 250px; min-height: 170px; box-shadow: 0 14px 50px #000d;
  border-width: 2px; transform: none; }
.showcase-layer .card.showcase .c-name { font-size: 16px; }
.showcase-layer .card.showcase .c-text { font-size: 12.5px; max-height: none; }
@keyframes showcase-in {
  from { transform: translateY(26px) scale(0.85); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* toast */
.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-12px);
  background: var(--danger); color: #fff; padding: 8px 18px; border-radius: 8px; z-index: 60;
  opacity: 0; transition: 0.3s; pointer-events: none; }
.toast.info { background: #3a6ea5; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  #side-right { display: none; }
  #b-row { flex-direction: column; }
}
