/* Card decks window, hand tray and chat card. Loaded from index.html. */

.dk { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.dk-list { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; border-right: 1px solid var(--rule); overflow-y: auto; background: rgba(5, 8, 13, .35); }
.dk-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 9px; text-align: left; background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none !important; }
.dk-item:hover:not(:disabled) { background: rgba(255, 255, 255, .03); border-color: var(--rule); }
.dk-item.on { color: #fff; border-color: var(--accent-dim); background: linear-gradient(90deg, rgba(220, 179, 92, .12), rgba(220, 179, 92, .02)); box-shadow: inset 2px 0 var(--accent) !important; }
.dk-count { font: 9px var(--mono); color: var(--dim-2); }
.dk-new { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.dk-detail { display: flex; flex-direction: column; gap: 8px; padding: 14px; overflow-y: auto; min-width: 0; }
.dk-none, .dk-empty { color: var(--dim); font-style: italic; font-size: 12px; }
.dk-empty { padding: 6px 0 10px; }
.dk-top { display: flex; gap: 16px; align-items: center; padding-bottom: 6px; }
.dk-top h3 { margin: 0; font: 600 17px var(--serif); letter-spacing: .08em; }
.dk-actions { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dk-actions .row { flex-wrap: wrap; gap: 6px; }
.dk-pile { position: relative; cursor: pointer; transition: transform .15s; }
.dk-pile:hover { transform: translateY(-3px); }
.dk-pile::before, .dk-pile::after { content: ""; position: absolute; inset: 0; border-radius: 6px; border: 1px solid var(--rule-2); background: #121826; z-index: -1; }
.dk-pile::before { transform: translate(3px, 3px); }
.dk-pile::after { transform: translate(6px, 6px); }
.dk-num { position: absolute; bottom: -6px; right: -10px; font: 700 10px var(--mono); background: var(--accent); color: #120e05; border-radius: 9px; padding: 1px 6px; }
.dk-row { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; }
.dk-card { padding: 0; background: none; border: 0; box-shadow: none !important; transition: transform .15s; }
.dk-card:hover:not(:disabled) { transform: translateY(-5px); background: none; }
.dk-hands { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); }
.dk-hand .dk-row { margin-top: 4px; }

.dk .kicker, #hand-tray .kicker, .chat-card .kicker { font: 700 8px var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--dim); }
.dk-detail > .kicker { margin-top: 6px; color: var(--accent); }
#hand-tray .kicker { color: var(--accent); text-shadow: 0 1px 4px #000; }

/* card faces */
.card-face { width: 78px; height: 110px; border-radius: 6px; border: 1px solid var(--rule-2); background: linear-gradient(160deg, #f4efe2, #ddd5c0); color: #1b1b22; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .45); background-size: cover; background-position: center; font-family: var(--serif); }
.card-face.small { width: 46px; height: 64px; border-radius: 4px; }
.card-face.back { background-color: #10182a; background-image: repeating-linear-gradient(45deg, rgba(220, 179, 92, .16) 0 2px, transparent 2px 9px), repeating-linear-gradient(-45deg, rgba(220, 179, 92, .16) 0 2px, transparent 2px 9px); border-color: var(--accent-dim); }
.card-face.back::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(220, 179, 92, .45); border-radius: 3px; }
.card-face.drawn.red { color: #a3202a; }
.card-pip { font-size: 34px; line-height: 1; }
.card-face.small .card-pip { font-size: 20px; }
.card-corner { position: absolute; top: 4px; left: 5px; font: 700 12px/1 var(--serif); text-align: center; }
.card-corner.flip { top: auto; left: auto; bottom: 4px; right: 5px; transform: rotate(180deg); }
.card-face.small .card-corner { font-size: 8px; top: 2px; left: 3px; }
.card-face.small .card-corner.flip { bottom: 2px; right: 3px; top: auto; left: auto; }
.card-title { font: 700 12px var(--serif); text-align: center; padding: 0 6px; }
.card-text { font: 9px/1.25 var(--sans); text-align: center; padding: 4px 6px 0; color: #3a3a44; overflow: hidden; max-height: 60px; }
.card-face.small .card-title { font-size: 8px; padding: 0 2px; }
.card-face.small .card-text { display: none; }
.card-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 4px 3px; font: 600 9px var(--sans); color: #fff; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); }
.card-face.small .card-cap { display: none; }

/* deck editor */
.dk-edit { border: 1px dashed var(--rule-2); border-radius: 4px; padding: 0 10px; margin-top: 8px; }
.dk-edit > summary { cursor: pointer; padding: 7px 0; font: 700 8.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.dk-edit[open] { padding-bottom: 10px; }
.dk-edit-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.dk-edit-top label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--dim); }
.dk-edit-top label.check { flex-direction: row; align-items: center; gap: 6px; }
.dk-back { display: flex; align-items: center; gap: 6px; }
.dk-cards { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 8px; }
.dk-crow { display: grid; grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 6px; align-items: center; }
.dk-edit .row { display: flex; gap: 6px; flex-wrap: wrap; }

/* hand tray */
#hand-tray { position: fixed; left: 66px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
#hand-tray[hidden] { display: none; }
#hand-tray > * { pointer-events: auto; }
.hand-fan { display: flex; padding: 10px 10px 0; }
.hand-card { padding: 0; margin-left: -18px; background: none; border: 0; box-shadow: none !important; transform: rotate(var(--a)) translateY(calc(var(--a) * var(--a) * .04px)); transform-origin: 50% 140%; transition: transform .15s; }
.hand-card:first-child { margin-left: 0; }
.hand-card:hover:not(:disabled) { transform: rotate(0) translateY(-14px) scale(1.25); background: none; z-index: 2; }
.hand-open { margin-top: 2px; }

/* chat card */
.chat-card { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.chat-card-face { cursor: pointer; flex: none; }
.chat-card-face .card-face { width: 62px; height: 88px; }
.chat-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; }
.chat-card-body b { font: 600 14px var(--serif); letter-spacing: .04em; }

@media (max-width: 620px) {
  .dk { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .dk-list { max-height: 150px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .dk-crow { grid-template-columns: 46px minmax(0, 1fr) auto auto; }
  .dk-crow input:nth-of-type(2) { display: none; }
}
