/* K's Game (K의 게임) — tournament-specific styles.
   Shared shell (app bar, panels, forms, roster, modal, toast, standings,
   K's-Game banner) comes from components.css; tokens from theme.css. This
   file holds the chain builder, the card draw, hand-off and the finale. */

/* ---- lobby: the chain builder (centre column) via the shared /lobby.js
   template. The .lchain block sits where a game's board frame would; the
   add-games palette (.adders) fills the settings column. ---- */
.lchain { width: 100%; max-width: 400px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow-float); padding: 16px 16px 14px; }
.lchain-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.lchain-h .eyebrow { letter-spacing: .16em; color: var(--ink-strong); }
.lchain-note { margin: 13px 2px 0; line-height: 1.5; }
.chain { display: flex; flex-direction: column; gap: 8px; }
.chainrow { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel-2); }
.chainrow.finale { border-color: var(--accent); background: var(--accent-soft); }
.chainrow.overfull { border-color: var(--c0); }
.ch-order { width: 18px; text-align: center; font: 600 .78rem var(--font-sans); color: var(--muted); }
.chainrow.finale .ch-order { color: var(--accent); }
.ch-icon { font-size: 1.15rem; line-height: 1; }
.ch-name { flex: 1; font: 400 1rem var(--font-serif); color: var(--ink-strong); }
.ch-x { border: 0; background: transparent; color: var(--muted); font-size: .9rem; line-height: 1; cursor: pointer; padding: 3px 6px; border-radius: var(--radius-sm); }
.ch-x:hover { color: var(--c0); background: var(--panel-3); }

/* add-games palette — a vertical stack of game buttons in the settings column */
.adders { display: flex; flex-direction: column; gap: 8px; }
.adder { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 12px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--panel); color: var(--ink); font: 600 .86rem var(--font-sans); cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.adder:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.adder:disabled { opacity: .5; cursor: not-allowed; }
.adder .ad-icon { font-size: 1.1rem; line-height: 1; }
.adder .ad-name { flex: 1; }
.adder .ad-plus { font-size: 1.15rem; color: var(--accent); font-weight: 400; }
.tag.over { background: var(--c0); color: #fff; border-color: var(--c0); }

/* ---- coins header (phase eyebrow pairs with coins here → space-between) ---- */
.roundhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.rh-left { display: flex; flex-direction: column; gap: 4px; }
.bank { font-weight: 600; font-size: 1.05rem; }
.rh-right { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.phase-eyebrow { justify-content: space-between; }

/* ---- the card draw ---- */
.draw-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 10px 0 12px; }
.kcard { width: 82px; height: 112px; border-radius: var(--radius-lg); background: var(--panel-2); border: 1px solid var(--accent); box-shadow: var(--shadow); display: grid; place-items: center; position: relative; }
.kcard.draw { cursor: pointer; padding: 0; transition: transform .12s ease, border-color .2s ease; }
.kcard.draw:not(:disabled):hover { transform: translateY(-3px); }
.kcard.draw:not(:disabled):active { transform: translateY(0); }
/* Face-down: a patterned back with a "?"; flips to reveal the value on claim. */
.kcard.draw:not(.flipped) { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 7px, var(--panel) 7px, var(--panel) 14px); }
.kcard.draw:not(.flipped):disabled { opacity: .5; }
.kcard.flipped { animation: cardflip .5s cubic-bezier(.2,.7,.3,1.1); cursor: default; }
.kcard.mine { border-width: 2px; box-shadow: 0 0 0 3px var(--accent-soft); }
.kcard-back { font: 600 2.2rem var(--font-serif); color: var(--accent); opacity: .7; }
.kcard-n { font: 600 2.2rem var(--font-serif); color: var(--accent); }
.kcard-n::before { content: '🪙 '; font-size: 1rem; vertical-align: .35em; }
.kc-owner { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); }
.kcard.mine .kc-owner { color: var(--accent); font-weight: 600; }
.draw-status { text-align: center; margin: 8px 0 0; font-size: .95rem; }
@keyframes cardflip { from { transform: rotateY(90deg) scale(.85); opacity: 0; } to { transform: rotateY(0) scale(1); opacity: 1; } }

/* ---- now playing / hand-off ---- */
.nowplaying { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-2); padding: 14px; margin: 10px 0 14px; }
.np-icon { font-size: 2rem; }
.np-name { font-family: var(--font-serif); font-size: 1.3rem; }
.btn.enter { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 0%,100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }

/* ---- standings / gains (adds a ready state + wider coins column) ---- */
.srow .rdy { font-size: .74rem; letter-spacing: .04em; }
.srow .rdy.on { color: var(--accent); font-weight: 600; }
.srow .rdy.off { color: var(--muted); }
.srow .coins { min-width: 3.4em; text-align: right; }
.nextline { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin: 14px 0 2px; }
.nextline b { font-family: var(--font-serif); font-size: 1.05rem; }

/* ---- finale: winner celebration / loser crying ---- */
.ks-finale { display: grid; place-items: center; padding: 8px 0 6px; }
.ks-finale .winline { margin: 8px 0 2px; }
/* celebration: a burst of confetti pieces raining down with a stagger */
.celebrate { position: relative; width: 200px; height: 92px; }
.celebrate .cpiece { position: absolute; top: -8px; font-size: 1.5rem; opacity: 0; animation: ks-confetti 1.5s ease-in infinite; }
.celebrate .c0 { left: 6%;  animation-delay: 0s;   }
.celebrate .c1 { left: 20%; animation-delay: .25s; }
.celebrate .c2 { left: 34%; animation-delay: .5s;  }
.celebrate .c3 { left: 48%; animation-delay: .1s;  }
.celebrate .c4 { left: 62%; animation-delay: .6s;  }
.celebrate .c5 { left: 76%; animation-delay: .35s; }
.celebrate .c6 { left: 90%; animation-delay: .15s; }
@keyframes ks-confetti {
  0%   { transform: translateY(-6px) rotate(0deg);    opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(92px) rotate(220deg);  opacity: 0; }
}
/* crying: a trembling sad face */
.cry { height: 92px; display: grid; place-items: center; }
.cryface { font-size: 3.2rem; display: inline-block; animation: ks-sob 1.1s ease-in-out infinite; }
@keyframes ks-sob {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  25%     { transform: translateY(2px) rotate(3deg); }
  50%     { transform: translateY(-2px) rotate(-3deg); }
  75%     { transform: translateY(2px) rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .kcard, .cpiece, .cryface { animation: none; }
  .cpiece { opacity: 0; }
  .btn.enter { animation: none; }
}
