:root {
  --ink: #eef2dc;
  --muted: #a8b19c;
  --panel: rgba(15, 23, 18, .92);
  --panel-2: rgba(24, 36, 27, .94);
  --line: rgba(199, 221, 164, .18);
  --moss: #8fac55;
  --lime: #c8e77f;
  --gold: #d9ad5b;
  --red: #d5644f;
  --blue: #72a8b5;
  --shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 50% 22%, rgba(108, 130, 66, .16), transparent 26rem),
    linear-gradient(rgba(8, 14, 11, .79), rgba(8, 14, 11, .94)),
    url("assets/霸王龙.jpg") center 18% / cover fixed;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .11;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}
button { font: inherit; }
button:focus-visible, .game-card:focus-visible, .dino-choice:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.app-shell { width: min(1180px, 100%); min-height: 100vh; margin: auto; padding: 18px 24px 210px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 58px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: #182015; background: var(--lime); font-weight: 900; clip-path: polygon(50% 0, 92% 24%, 92% 76%, 50% 100%, 8% 76%, 8% 24%); }
.topbar h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 21px; letter-spacing: .12em; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.topbar .ghost-btn { margin-left: auto; }
.profile-bar { display: flex; gap: 8px; margin-left: auto; }
.profile-bar span { padding: 7px 10px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 8px; font-size: 9px; }
.profile-bar b { color: var(--lime); margin-left: 4px; }
.profile-bar + .ghost-btn { margin-left: 0; }

.battlefield { display: grid; grid-template-columns: 1fr minmax(280px, .7fr) 1fr; gap: 22px; align-items: center; padding-top: 26px; }
.fighter { position: relative; min-height: 480px; border: 1px solid var(--line); background: linear-gradient(150deg, rgba(32, 47, 34, .9), rgba(12, 19, 15, .96)); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.fighter.active { border-color: rgba(200, 231, 127, .65); box-shadow: 0 0 0 1px rgba(200,231,127,.12), var(--shadow); }
.fighter-portrait { position: absolute; inset: 0 0 40%; background-position: center 20%; background-size: cover; filter: saturate(.78) contrast(1.04); }
.fighter-portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, #142018 98%); }
.fighter.enemy .fighter-portrait { transform: scaleX(-1); }
.fighter-content { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: flex-end; min-height: 480px; padding: 20px; }
.fighter-label { color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.fighter h2 { margin: 4px 0 12px; font-family: Georgia, "Songti SC", serif; font-size: 30px; }
.hp-row { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.hp-value { font-size: 20px; }
.hp-bar { height: 10px; margin: 7px 0 14px; overflow: hidden; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; }
.hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ba443e, #dc8460); transition: width .45s ease; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { padding: 7px 8px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); border-radius: 8px; }
.stat small { display: block; color: var(--muted); font-size: 9px; }
.stat b { font-size: 13px; }
.ability { margin-top: 10px; padding: 9px 10px; color: #dce5cc; background: rgba(143,172,85,.1); border-left: 2px solid var(--moss); font-size: 11px; line-height: 1.45; }
.status-row { display: flex; flex-wrap: wrap; min-height: 25px; gap: 5px; margin-top: 9px; }
.status-pill { padding: 4px 7px; color: #f1d7a8; background: rgba(215,156,75,.14); border: 1px solid rgba(215,156,75,.3); border-radius: 999px; font-size: 9px; }

.center-stage { align-self: stretch; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.round-strip { display: flex; justify-content: center; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.divider { width: 1px; height: 11px; background: var(--line); }
.event-card { display: flex; align-items: center; gap: 11px; margin: 16px 0; padding: 14px; background: linear-gradient(135deg, rgba(72,63,41,.95), rgba(29,31,23,.96)); border: 1px solid rgba(217,173,91,.35); border-radius: 14px; transition: .3s ease; }
.event-card.dormant { filter: grayscale(.75); opacity: .72; }
.event-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; color: var(--gold); background: rgba(217,173,91,.1); border: 1px solid rgba(217,173,91,.3); border-radius: 50%; font-size: 22px; }
.event-card small { display: block; color: var(--gold); font-size: 8px; letter-spacing: .2em; }
.event-card strong { display: block; margin: 3px 0; font-family: Georgia, "Songti SC", serif; }
.event-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.event-duration { margin-left: auto; align-self: flex-start; color: var(--gold); font-size: 9px; white-space: nowrap; }
.combat-banner { padding: 14px 10px; text-align: center; color: #d4ddc5; background: rgba(4,9,6,.4); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: Georgia, "Songti SC", serif; font-size: 13px; transition: .25s; }
.combat-banner.flash { color: #fff; background: rgba(181,77,52,.4); transform: scale(1.02); }
.log-toggle { margin-top: 12px; padding: 8px; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 10px; }
.battle-log { max-height: 112px; margin: 0; padding: 0 8px 0 26px; overflow: auto; color: var(--muted); font-size: 9px; line-height: 1.65; }
.battle-log.collapsed { display: none; }

.hand-area { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; padding: 12px max(24px, calc((100vw - 1132px) / 2)); background: linear-gradient(180deg, rgba(10,16,12,.55), rgba(10,16,12,.98) 22%); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }
.resource-row { display: flex; align-items: center; min-height: 35px; gap: 10px; }
.resource-row > span { color: var(--muted); font-size: 10px; }
.deck-text { padding-left: 10px; border-left: 1px solid var(--line); }
.energy-orbs { display: flex; gap: 4px; }
.orb { width: 11px; height: 11px; background: rgba(255,255,255,.08); border: 1px solid rgba(200,231,127,.25); border-radius: 50%; }
.orb.full { background: var(--lime); box-shadow: 0 0 9px rgba(200,231,127,.55); }
.end-turn-btn, .primary-btn { padding: 9px 18px; color: #172012; background: linear-gradient(135deg, var(--lime), #91b65a); border: 0; border-radius: 8px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 22px rgba(121,161,72,.2); }
.end-turn-btn { margin-left: auto; }
.end-turn-btn:disabled, .primary-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: 126px; gap: 8px; overflow-x: auto; padding: 6px 4px 0; }
.game-card { position: relative; flex: 0 0 90px; height: 124px; padding: 10px 8px; color: var(--ink); background: linear-gradient(160deg, #29382a, #151e17); border: 1px solid rgba(214,228,188,.28); border-radius: 9px; cursor: pointer; transform-origin: bottom; transition: .18s ease; overflow: hidden; }
.game-card::after { content: ""; position: absolute; width: 65px; height: 65px; right: -24px; bottom: -25px; background: var(--card-color, var(--moss)); border-radius: 50%; filter: blur(20px); opacity: .3; }
.game-card:hover:not(:disabled) { transform: translateY(-8px) scale(1.04); border-color: var(--lime); }
.game-card:disabled { opacity: .37; cursor: not-allowed; filter: grayscale(.6); }
.card-cost { position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 21px; height: 21px; color: #182015; background: var(--lime); border-radius: 50%; font-size: 11px; font-weight: 900; }
.card-icon { display: block; margin: 5px 0 7px; font-size: 24px; }
.game-card strong { display: block; font-size: 13px; }
.game-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.game-card.reaction { --card-color: #69a8b3; }
.game-card.recovery { --card-color: #d39e4d; }
.game-card.utility { --card-color: #ac7bc8; }

.ghost-btn { padding: 8px 14px; color: var(--ink); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.modal { position: fixed; z-index: 30; inset: 0; display: none; place-items: center; padding: 18px; background: rgba(4,8,5,.78); backdrop-filter: blur(12px); }
.modal.visible { display: grid; animation: fade .2s ease; }
.modal-card { position: relative; width: min(520px, 100%); padding: 30px; background: linear-gradient(145deg, #1b2a1e, #101812); border: 1px solid rgba(200,231,127,.23); border-radius: 20px; box-shadow: var(--shadow); text-align: center; }
.selection-card { width: min(1000px, 100%); }
.eyebrow { margin: 0 0 7px; color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.modal h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 31px; }
.modal-copy { color: var(--muted); font-size: 12px; line-height: 1.65; }
.dino-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.dino-choice { position: relative; min-height: 330px; padding: 0; overflow: hidden; color: var(--ink); background: #152018; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left; transition: .2s ease; }
.dino-choice:hover { transform: translateY(-5px); border-color: var(--lime); box-shadow: 0 14px 28px rgba(0,0,0,.35); }
.dino-art { height: 155px; background-position: center 18%; background-size: cover; }
.dino-art::after { content: ""; display: block; height: 100%; background: linear-gradient(transparent, #152018); }
.dino-info { padding: 12px; }
.dino-info h3 { margin: 0 0 6px; font-family: Georgia, "Songti SC", serif; font-size: 19px; }
.dino-tags { color: var(--lime); font-size: 9px; }
.dino-info p { min-height: 42px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.mini-stats { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); font-size: 9px; }
.recommended::before { content: "推荐"; position: absolute; z-index: 2; top: 10px; left: 10px; padding: 4px 7px; color: #182015; background: var(--lime); border-radius: 5px; font-size: 9px; font-weight: 900; }
.dino-choice.locked { cursor: not-allowed; filter: grayscale(.82); }
.dino-choice.locked:hover { transform: none; border-color: var(--line); }
.dino-choice.locked::after { content: attr(data-lock); position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 30px; color: white; background: rgba(4,8,5,.63); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.difficulty-picker { display: inline-flex; gap: 8px; padding: 5px; margin-top: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 11px; }
.difficulty-btn { min-width: 145px; padding: 9px 12px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-weight: 800; }
.difficulty-btn small { display: block; margin-top: 2px; font-size: 8px; font-weight: 400; }
.difficulty-btn.active { color: #172012; background: var(--lime); }
.difficulty-btn.active small { color: rgba(23,32,18,.7); }
.text-btn { margin-top: 14px; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; font-size: 9px; }
.danger-pulse { display: grid; place-items: center; width: 48px; height: 48px; margin: -55px auto 14px; color: white; background: var(--red); border: 5px solid #1b2a1e; border-radius: 50%; font-size: 24px; font-weight: 900; box-shadow: 0 0 22px rgba(213,100,79,.5); }
.timer-bar { height: 4px; margin: 20px 0; overflow: hidden; background: rgba(255,255,255,.08); border-radius: 5px; }
.timer-bar i { display: block; width: 100%; height: 100%; background: var(--red); transform-origin: left; }
.timer-bar.running i { animation: timer 8s linear forwards; }
.modal-actions { display: flex; justify-content: center; gap: 9px; }
.result-emblem { margin-bottom: 12px; color: var(--gold); font-size: 48px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.result-stats div { padding: 12px 6px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 9px; }
.result-stats b, .result-stats small { display: block; }
.result-stats small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.rules-card { text-align: left; }
.close-btn { position: absolute; top: 14px; right: 16px; color: var(--muted); background: none; border: 0; font-size: 25px; cursor: pointer; }
.rules-list p { display: flex; align-items: flex-start; gap: 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.rules-list b { display: grid; place-items: center; flex: 0 0 24px; height: 24px; color: #182015; background: var(--lime); border-radius: 50%; }
.toast { position: fixed; z-index: 50; top: 78px; left: 50%; padding: 10px 18px; color: #172012; background: var(--lime); border-radius: 8px; font-size: 11px; font-weight: 800; opacity: 0; transform: translate(-50%, -12px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.damage-float { position: fixed; z-index: 20; color: #ff896f; font-family: Georgia, serif; font-size: 32px; font-weight: 900; pointer-events: none; animation: floatDamage 1s ease forwards; text-shadow: 0 3px 12px #000; }

@keyframes fade { from { opacity: 0; } }
@keyframes timer { to { transform: scaleX(0); } }
@keyframes floatDamage { from { opacity: 0; transform: translateY(10px) scale(.7); } 25% { opacity: 1; } to { opacity: 0; transform: translateY(-55px) scale(1.15); } }

@media (max-width: 850px) {
  .app-shell { padding: 10px 12px 210px; }
  .battlefield { grid-template-columns: 1fr 1fr; gap: 10px; }
  .center-stage { grid-column: 1 / -1; grid-row: 2; }
  .fighter { min-height: 365px; }
  .fighter-content { min-height: 365px; padding: 13px; }
  .fighter-portrait { inset-bottom: 50%; }
  .fighter h2 { font-size: 23px; }
  .ability { font-size: 9px; }
  .battle-log { max-height: 75px; }
  .dino-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-bar span:last-child { display: none; }
}

@media (max-width: 520px) {
  .app-shell { padding-bottom: 195px; }
  .topbar p { display: none; }
  .profile-bar { display: none; }
  .battlefield { padding-top: 12px; }
  .fighter { min-height: 310px; border-radius: 14px; }
  .fighter-content { min-height: 310px; padding: 10px; }
  .fighter h2 { margin-bottom: 7px; font-size: 19px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(n+5) { display: none; }
  .ability { max-height: 50px; overflow: auto; }
  .hand-area { padding-inline: 10px; }
  .hand { justify-content: flex-start; min-height: 115px; }
  .game-card { flex-basis: 82px; height: 112px; }
  .dino-grid { grid-template-columns: 1fr 1fr; }
  .dino-choice { min-height: 265px; }
  .dino-art { height: 110px; }
  .dino-info p { display: none; }
  .selection-card { max-height: 95vh; padding: 20px 14px; overflow: auto; }
  .modal-actions { flex-direction: column; }
}
