:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; background: #090d1b; color: #eef2ff; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -10%, #30365d 0, #10172b 38%, #090d1b 78%); }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; background: #252d49; border: 1px solid #455072; border-radius: 11px; padding: 11px 15px; transition: background .15s, transform .15s, border-color .15s; }
button:hover:not(:disabled) { background: #35416b; transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
input { color: #fff; background: #10172b; border: 1px solid #455072; border-radius: 11px; padding: 11px 14px; min-width: 0; }
.hidden { display: none !important; }
.shell { max-width: 1440px; margin: auto; padding: 0 22px 34px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 21px; letter-spacing: .19em; font-weight: 900; }
.brand-mark { color: #d6a976; font-size: 30px; vertical-align: -2px; margin-right: 5px; }
.brand small { display: block; margin-left: 39px; color: #9aa7c5; font-size: 10px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; }
.text-button { background: transparent; border: 0; color: #aab7d6; }
.panel { border: 1px solid #35405f; background: linear-gradient(155deg, rgba(29,36,62,.95), rgba(17,25,44,.96)); border-radius: 19px; box-shadow: 0 18px 55px #0004; }
.eyebrow { display: block; color: #bdc8e5; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 16px; }
.muted, .hint { color: #aab7d3; }
.lobby { max-width: 760px; margin: 10vh auto 0; padding: clamp(28px, 5vw, 60px); }
.lobby h1 { margin: 20px 0; }
.lobby p { line-height: 1.65; max-width: 610px; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 13px; margin: 30px 0 23px; }
.lobby-actions form { display: flex; gap: 8px; }
.lobby-actions input { width: 145px; text-transform: uppercase; }
.hint { font-size: 13px; }
.primary-button { background: linear-gradient(135deg, #bd835d, #d5a56e); border-color: #e6b784; color: #191522; font-weight: 800; }
.primary-button:hover:not(:disabled) { background: linear-gradient(135deg, #d69c71, #f0be83); }
.game-head { padding: 20px 26px; display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.game-head h1 { margin: 6px 0 3px; font-size: 25px; }
.game-head p { margin-bottom: 0; font-size: 13px; }
.invite { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.arena-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.arena { padding: 18px 23px 23px; }
.wizard { display: flex; align-items: center; gap: 12px; padding: 7px 2px; }
.wizard strong { display: block; margin-top: 3px; font-size: 16px; }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #776987; border-radius: 50%; background: #49394f; color: #e9c8ba; font-size: 23px; }
.my-wizard .avatar { border-color: #86714e; background: #4a3e31; color: #f7dca2; }
.health { position: relative; margin-left: auto; font-size: 20px; font-weight: 800; color: #f1999e; }
.mana { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 13px; }
.mana-pill { padding: 5px 8px; border-radius: 7px; border: 1px solid #47516a; font-size: 11px; font-weight: 700; background: #131c31; }
.mana-pill strong { margin-left: 4px; color: #fff; }
.lane-label { color: #8f9fbd; font-size: 9px; font-weight: 800; letter-spacing: .17em; margin: 12px 0 7px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.slot { position: relative; min-height: 170px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding: 9px; border: 1px dashed #5b6682; background: #121a30; border-radius: 12px; text-align: center; }
.slot.selectable { border-color: #d5a56e; background: #312b32; cursor: pointer; }
.slot.selectable:hover { background: #46383a; }
.slot .slot-number { color: #697994; font-size: 11px; }
.slot .empty { color: #697994; font-size: 12px; }
.unit { position: relative; z-index: 2; width: 100%; min-height: 145px; border: 1px solid var(--school); border-radius: 9px; background: linear-gradient(145deg, color-mix(in srgb, var(--school) 20%, #18213b), #111b30); padding: 10px 7px; display: flex; flex-direction: column; justify-content: space-between; }
.unit-name { font-weight: 800; font-size: 13px; }
.unit-school { font-size: 10px; color: #c7d1e6; }
.unit-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; margin-top: auto; font-weight: 900; font-size: 15px; white-space: nowrap; }
.unit-health { color: #f1999e; }
.skill-button { flex: none; width: 26px; height: 26px; padding: 0; border-radius: 50%; border-color: #e0bf7e; color: #f8d9a2; background: #534437; font-size: 16px; line-height: 1; }
.skill-button.selected { outline: 2px solid #f2c688; }
.combat-number { position: absolute; z-index: 5; top: 35%; left: 50%; transform: translate(-50%, 0); font-size: 34px; font-weight: 1000; pointer-events: none; animation: damage-float 1s ease-out forwards; }
.damage-number { color: #ff7987; text-shadow: 0 2px 8px #000, 0 0 15px #a02537; }
.heal-number { color: #80e9a5; text-shadow: 0 2px 8px #000, 0 0 15px #237846; }
.health .combat-number { top: -32px; left: 50%; }
.unit.attack-up { animation: attack-up .325s ease-in-out; }
.unit.attack-down { animation: attack-down .325s ease-in-out; }
@keyframes attack-up { 0%, 100% { transform: translateY(0); } 45%, 65% { transform: translateY(-44px); } }
@keyframes attack-down { 0%, 100% { transform: translateY(0); } 45%, 65% { transform: translateY(44px); } }
@keyframes damage-float { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 20%, 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -22px) scale(1.1); } }
.unit-new { font-size: 10px; color: #e3bd89; }
.battle-divider { display: flex; align-items: center; gap: 13px; margin: 11px 0; color: #ad8e79; }
.battle-divider::before, .battle-divider::after { content: ''; flex: 1; border-top: 1px solid #46516d; }
.card-panel { position: relative; min-width: 0; padding: 21px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading > div > span { color: #9ba9c7; font-size: 11px; }
.card-panel p { font-size: 12px; line-height: 1.4; min-height: 32px; }
.school-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.school-tab { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 7px 4px; border-color: color-mix(in srgb, var(--school) 55%, #455072); background: color-mix(in srgb, var(--school) 10%, #141c30); font-size: 11px; }
.school-tab.active { border-color: var(--school); background: color-mix(in srgb, var(--school) 30%, #141c30); box-shadow: inset 0 0 0 1px var(--school); }
.school-icon { font-size: 16px; line-height: 1; }
.school-name { overflow: hidden; text-overflow: ellipsis; }
.card-list { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 12px; overflow-x: auto; }
.card-entry { min-width: 0; }
.card-button { width: 100%; text-align: left; padding: 10px; min-height: 92px; border-color: var(--school); background: color-mix(in srgb, var(--school) 12%, #131b2e); }
.card-original { display: block; margin: 3px 2px 8px; color: #bdc8e5; font-size: 10px; text-decoration: none; }
.card-art { display: block; width: 100%; aspect-ratio: 484 / 311; object-fit: cover; border-radius: 5px; margin-bottom: 7px; }
.card-button.selected { outline: 2px solid #f2c688; }
.card-button .card-top { display: flex; justify-content: space-between; gap: 5px; font-weight: 800; font-size: 12px; }
.card-button .card-kind { display: block; margin: 5px 0; color: #aebdd6; font-size: 10px; }
.card-button .card-description { color: #c6d0e2; font-size: 10px; line-height: 1.35; }
.end-turn { display: block; margin: 15px 0 0 auto; min-width: 255px; }
.battle-history summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; border: 1px solid #455072; border-radius: 10px; padding: 9px 12px; background: #252d49; font-size: 12px; }
.battle-history summary::-webkit-details-marker { display: none; }
.battle-history summary:hover { background: #35416b; }
.battle-history[open] summary span { transform: rotate(180deg); }
.history-popover { position: absolute; top: 60px; right: 21px; z-index: 20; width: min(380px, calc(100% - 42px)); padding: 18px; }
.history-popover h2 { margin-bottom: 11px; }
.log { display: flex; flex-direction: column; gap: 8px; max-height: min(350px, 50vh); overflow: auto; }
.log div { color: #aebbd5; font-size: 12px; border-left: 2px solid #5b6c96; padding-left: 10px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); border-radius: 11px; background: #912f41; box-shadow: 0 10px 40px #0008; padding: 12px 18px; z-index: 5; }
@media (max-width: 1000px) { .board { gap: 8px; } .slot { min-height: 145px; } .unit { min-height: 122px; } .school-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); } .card-list { grid-template-columns: repeat(3, minmax(0, 1fr)); overflow-x: visible; } }
@media (max-width: 600px) { .shell { padding: 0 10px 22px; } .topbar { height: 65px; } .game-head { padding: 17px; align-items: flex-start; flex-direction: column; } .arena { padding: 12px; } .board { gap: 4px; } .slot { min-height: 104px; padding: 3px; } .unit { min-height: 97px; padding: 5px 3px; } .unit-name { font-size: 10px; } .unit-school, .unit-new { font-size: 8px; } .unit-stats { font-size: 10px; } .skill-button { width: 19px; height: 19px; font-size: 12px; } .card-list { grid-template-columns: 1fr 1fr; } .end-turn { width: 100%; min-width: 0; } }
@media (prefers-reduced-motion: reduce) { .unit.attack-up, .unit.attack-down, .combat-number { animation-duration: .01ms; } }
