/* style.css - Huanghua Online site: shared look for the player pages and the admin panel */
:root {
	color-scheme: dark;
	--ink: #f3e6c4;
	--gold: #d6a84a;
	--gold-soft: #a9813a;
	--deep: #140b05;
	--panel: #24160b;
	--panel-2: #2f1d0f;
	--line: #5a3d1c;
	--muted: #b39b72;
	--ok: #6fbf6a;
	--bad: #d0604c;
	--warn: #e0b04a;
	--font-display: "Cinzel", Georgia, "Times New Roman", serif;
	--font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	min-height: 100vh;
	background: radial-gradient(ellipse at 50% 0%, #3a220f 0%, var(--deep) 65%) fixed;
	color: var(--ink);
	font-family: var(--font-body);
	line-height: 1.55;
}
h1, h2, h3, .brand, .btn, .tab, .stat .value, .eyebrow, th, .strip .value, .strip .label, .chip, .rank-badge {
	font-family: var(--font-display);
}
h1, h2, h3 { font-weight: 700; letter-spacing: .04em; }
.btn, .tab { letter-spacing: .05em; font-weight: 500; }
th { font-size: .74rem; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

header.top {
	border-bottom: 1px solid var(--line);
	background: rgba(20, 11, 5, .7);
	position: sticky; top: 0; z-index: 5;
	backdrop-filter: blur(6px);
}
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { font-size: 1.35rem; letter-spacing: .18em; color: var(--gold); text-decoration: none; font-weight: bold; }
.brand small { font-size: .65rem; letter-spacing: .2em; color: var(--muted); margin-left: 8px; font-weight: normal; }
nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 9px 18px; border: 1px solid var(--gold-soft); background: var(--panel-2);
	color: var(--ink); text-decoration: none; cursor: pointer; border-radius: 3px;
}
.btn:hover { background: #4a2e16; border-color: var(--gold); }
.btn.primary { background: #6a4218; border-color: var(--gold); }
.btn.primary:hover { background: #855423; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { border-color: #8a3b2d; }
.btn.danger:hover { background: #5a2218; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.hero { text-align: center; padding: 64px 0 40px; }
.eyebrow { color: var(--muted); font-size: .75rem; letter-spacing: .22em; }
.hero h1 { margin: 14px 0; font-size: clamp(2.4rem, 8vw, 4.2rem); letter-spacing: .12em; color: var(--gold); }
.rule { height: 1px; margin: 22px auto; width: 70%; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.hero p { margin: .6em auto; max-width: 560px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.hint { color: var(--muted); font-size: .88rem; }

.status-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.status-row.left { justify-content: flex-start; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--muted); background: rgba(0,0,0,.25); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #666; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.bad { background: var(--bad); }

.card { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 4px; padding: 22px; margin: 18px 0; }
.card h2 { margin: 0 0 14px; color: var(--gold); font-size: 1.25rem; letter-spacing: .05em; }
.card h3 { margin: 18px 0 10px; color: var(--gold); font-size: 1.05rem; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 16px; cursor: pointer; color: var(--muted); }
.tab[aria-selected="true"] { color: var(--gold); border-bottom-color: var(--gold); }

form.stack { display: grid; gap: 12px; }
label { display: grid; gap: 5px; font-size: .9rem; color: var(--muted); }
input, select, textarea { padding: 9px 11px; background: #120a04; border: 1px solid var(--line); border-radius: 3px; width: 100%; }
textarea { resize: vertical; min-height: 70px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > .btn { flex: 0 0 auto; }

.msg { padding: 10px 12px; border-radius: 3px; font-size: .92rem; margin: 0; }
.msg:empty { display: none; }
.msg.error { background: rgba(208, 96, 76, .15); border: 1px solid #8a3b2d; color: #f1b5a8; }
.msg.ok { background: rgba(111, 191, 106, .12); border: 1px solid #3f7a3b; color: #bfe6bb; }
.msg.info { background: rgba(224, 176, 74, .1); border: 1px solid #7a5f24; color: #f0d79b; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: normal; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
td.actions { display: flex; gap: 6px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { border-color: #3f7a3b; color: #bfe6bb; }
.tag.bad { border-color: #8a3b2d; color: #f1b5a8; }
.tag.gold { border-color: var(--gold-soft); color: var(--gold); }
.empty { color: var(--muted); text-align: center; padding: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 4px; padding: 14px; }
.stat .value { font-size: 1.8rem; color: var(--gold); }
.stat .label { color: var(--muted); font-size: .82rem; }
pre.log { background: #0c0603; border: 1px solid var(--line); padding: 12px; max-height: 280px; overflow: auto; font-family: Consolas, monospace; font-size: .8rem; white-space: pre-wrap; margin: 10px 0 0; }

/* character editor */
.editor-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.editor-head h2 { margin: 0; color: var(--gold); flex: 1 1 auto; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor-grid .card { margin: 0 0 18px; }
.stat-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pending { margin: 12px 0; padding-left: 18px; color: var(--warn); font-size: .88rem; }
.pending:empty { display: none; }
.inv-section-title { color: var(--muted); font-size: .8rem; letter-spacing: .06em; margin: 12px 0 6px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 5px; }
.slot {
	width: 48px; height: 48px; border: 1px solid var(--line); background: #0f0803; border-radius: 3px;
	position: relative; display: grid; place-items: center; cursor: default;
}
.slot.drop-target { border-color: var(--gold); background: #2a1a0a; }
.slot .label { position: absolute; inset: auto 0 1px 0; text-align: center; font-size: .55rem; color: #6c5634; pointer-events: none; }
.slot.filled { cursor: pointer; border-color: var(--gold-soft); }
.slot.selected { outline: 2px solid var(--gold); }
.slot.pending-change { border-color: var(--warn); }
.slot img { width: 40px; height: 40px; image-rendering: pixelated; pointer-events: none; }
.slot .badge { position: absolute; font-size: .65rem; background: rgba(0,0,0,.75); padding: 0 3px; border-radius: 2px; pointer-events: none; }
.slot .plus { top: 1px; right: 1px; color: #8fd0ff; }
.slot .count { bottom: 1px; right: 1px; color: var(--ink); }
.slot .noicon { font-size: .55rem; color: var(--muted); text-align: center; padding: 2px; overflow: hidden; }
.trash { margin-top: 12px; padding: 10px; border: 1px dashed #8a3b2d; color: #f1b5a8; text-align: center; border-radius: 3px; font-size: .88rem; }
.trash.drop-target { background: rgba(208, 96, 76, .2); }
.item-detail { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: rgba(0,0,0,.25); }
.item-detail-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.item-detail-head img { width: 40px; height: 40px; }
.catalog { position: sticky; top: 72px; }
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.picker-grid .span-2 { grid-column: 1 / -1; }
#pk-all { margin-top: 10px; width: 100%; }
.cat-item.missing { opacity: .45; cursor: default; }
.cat-item .slot-name { color: var(--gold-soft); font-size: .7rem; letter-spacing: .04em; }
.catalog-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.catalog-filters input[type="search"] { grid-column: 1 / -1; }
label.inline { display: flex; align-items: center; gap: 6px; }
label.inline input[type="number"] { width: 80px; }
label.inline input[type="checkbox"] { width: auto; }
.catalog-list { display: grid; gap: 4px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.cat-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid transparent; border-radius: 3px; cursor: grab; background: rgba(0,0,0,.2); }
.cat-item:hover { border-color: var(--gold-soft); }
.cat-item img, .cat-item .noicon { width: 32px; height: 32px; flex: none; }
.cat-item .meta { min-width: 0; flex: 1; }
.cat-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.cat-item .code { color: var(--muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item .give { flex: none; }
@media (max-width: 900px) {
	.editor-grid { grid-template-columns: 1fr; }
	.catalog { position: static; }
}

footer.bottom { color: var(--muted); font-size: .8rem; text-align: center; padding: 30px 0 40px; }
[hidden] { display: none !important; }

@media (max-width: 600px) {
	header.top .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-direction: column; }
	.card { padding: 16px; }
}
