:root {
  color-scheme: dark;
  --ink: #edf1e8;
  --muted: #9ba69c;
  --bg: #0d1210;
  --panel: #151b18;
  --panel-2: #1c2420;
  --line: #344139;
  --gold: #d8a94a;
  --gold-bright: #f0d28d;
  --green: #64b486;
  --red: #df786f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 14% -10%,
      rgba(63, 102, 77, 0.34),
      transparent 32rem
    ),
    radial-gradient(
      circle at 90% 10%,
      rgba(111, 82, 39, 0.18),
      transparent 28rem
    ),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
button:not(:disabled) {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 18, 16, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  letter-spacing: 0.11em;
}
.brand b {
  display: block;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 500;
}
.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.24em;
}
.brand-crystal {
  display: none;
}
.brand::before {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  content: "✦";
  color: var(--gold-bright);
  font-size: 18px;
  border: 1px solid var(--gold);
  background: transparent;
  clip-path: polygon(50% 0, 93% 28%, 80% 82%, 50% 100%, 19% 82%, 7% 28%);
}

.room-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}
.room-code {
  padding-right: 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  border-right: 1px solid var(--line);
}
.room-code b {
  color: var(--gold-bright);
  font-size: 15px;
  letter-spacing: 0.17em;
}
.text-button {
  padding: 5px 0;
  color: var(--muted);
  font-size: 12px;
  border: 0;
  background: transparent;
}
.text-button:hover {
  color: var(--ink);
}
.text-button.active {
  color: var(--gold-bright);
}

main {
  width: min(1600px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(40px, 6vw, 84px) 0 80px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 64px);
  color: #65766f;
  font-size: 10px;
  letter-spacing: 0.14em;
  border-top: 1px solid #18241f;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, "Yu Mincho", serif;
  font-weight: 400;
}
h1 {
  margin-bottom: 18px;
  font-size: clamp(40px, 6vw, 78px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}
h2 {
  margin-bottom: 10px;
  font-size: clamp(28px, 3vw, 42px);
}
h3 {
  margin-bottom: 16px;
  color: var(--gold-bright);
  font-size: 11px;
  letter-spacing: 0.18em;
}
p {
  color: var(--muted);
  line-height: 1.8;
}
em {
  color: var(--gold-bright);
  font-style: normal;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.27em;
  text-transform: uppercase;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(
    145deg,
    rgba(24, 38, 34, 0.94),
    rgba(13, 22, 20, 0.96)
  );
  box-shadow: var(--shadow);
}

.btn {
  min-height: 44px;
  padding: 11px 20px;
  color: #111712;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-bright), #bb8e47);
  box-shadow: 0 7px 25px rgba(183, 137, 67, 0.15);
}
.btn:not(:disabled):hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-secondary {
  color: var(--ink);
  border-color: #477766;
  background: #24483d;
}
.btn-ghost {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(5, 10, 9, 0.28);
  box-shadow: none;
}
.btn-danger {
  color: #ffd9d9;
  border-color: #7e3e43;
  background: #54262b;
  box-shadow: none;
}
.btn.full {
  width: 100%;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.07em;
}
input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid #334942;
  border-radius: 2px;
  outline: none;
  background: #0a1210;
}
textarea {
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(224, 182, 104, 0.1);
}

.notice {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 100;
  max-width: min(560px, calc(100vw - 30px));
  padding: 13px 18px;
  color: #dff9ec;
  font-size: 13px;
  border: 1px solid #4e9275;
  background: #173d30;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}
.notice.error {
  color: #ffe2e2;
  border-color: #9e5357;
  background: #4a2529;
}
.busy::after {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 100%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: loading 1s linear infinite;
}
@keyframes loading {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(520px, 1.18fr);
  gap: clamp(40px, 6vw, 100px);
  align-items: center;
  min-height: 520px;
  margin-bottom: 100px;
}
.hero-copy {
  max-width: 620px;
}
.hero-copy p {
  max-width: 520px;
  font-size: 16px;
}
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.entry-card {
  position: relative;
  min-height: 345px;
  padding: 34px 28px 28px;
  overflow: hidden;
}
.entry-card h2 {
  margin-bottom: 35px;
  font-size: 27px;
}
.entry-card label {
  margin-bottom: 17px;
}
.entry-card .btn {
  width: 100%;
  margin-top: 8px;
}
.entry-number {
  position: absolute;
  top: 14px;
  right: 18px;
  color: rgba(224, 182, 104, 0.16);
  font-family: Georgia, serif;
  font-size: 70px;
  line-height: 1;
}
.room-code-input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.deck-builder {
  padding-top: 20px;
  scroll-margin-top: 100px;
}
.deck-name-field {
  max-width: 460px;
  margin-bottom: 18px;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.deck-totals {
  display: flex;
  gap: 10px;
}
.deck-totals span {
  min-width: 110px;
  padding: 10px 13px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  border: 1px solid var(--line);
  background: #0a1210;
}
.deck-totals b {
  color: var(--ink);
  font-size: 17px;
}
.deck-totals .valid {
  border-color: #3b755e;
}
.deck-totals .valid b {
  color: var(--green);
}
.deck-totals .invalid {
  border-color: #793b40;
}
.deck-input-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 16px;
  margin-bottom: 16px;
}
.compact-form {
  padding: 22px;
}
.compact-form label {
  margin-bottom: 13px;
}
.form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field-help {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.6;
}
.card-search-results {
  display: grid;
  gap: 6px;
  max-height: 360px;
  margin-top: 14px;
  overflow: auto;
}
.card-search-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 6px 9px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-left-width: 3px;
  background: #0b1512;
}
.card-search-result:hover {
  border-color: var(--gold);
}
.card-search-result img {
  width: 42px;
  height: 58px;
  object-fit: cover;
  border-radius: 2px;
}
.card-search-result span,
.card-search-result b,
.card-search-result small,
.card-search-result em {
  display: block;
  min-width: 0;
}
.card-search-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.card-search-result em {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: #aebdb7;
  font-size: 8px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-search-result > strong {
  color: var(--gold-bright);
  font-size: 10px;
}
.deck-import-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.deck-columns {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
}
.deck-list {
  min-height: 230px;
  padding: 22px;
  box-shadow: none;
}
.deck-list h3 {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.deck-list h3 span {
  color: var(--muted);
}
.deck-rows {
  display: grid;
  gap: 5px;
}
.deck-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 51px;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  border-left: 3px solid #65706d;
  background: rgba(5, 10, 9, 0.42);
}
.deck-card-thumbnail {
  width: 38px;
  height: 53px;
  object-fit: cover;
  border-radius: 2px;
}
.deck-card-name b,
.deck-card-name small {
  display: block;
}
.deck-card-name b {
  font-size: 13px;
}
.deck-card-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.deck-card-name p {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: #aebdb7;
  font-size: 9px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.count-stepper {
  display: flex;
  align-items: center;
  gap: 7px;
}
.count-stepper button {
  width: 31px;
  height: 31px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #101a18;
}
.count-stepper button:hover {
  color: var(--ink);
  border-color: var(--gold);
}
.count-stepper strong {
  min-width: 16px;
  text-align: center;
}
.deck-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.locked-banner {
  margin-bottom: 16px;
  padding: 13px 16px;
  color: #bdebd7;
  font-size: 12px;
  border: 1px solid #356b55;
  background: #123327;
}
.empty-zone {
  display: grid;
  min-height: 58px;
  place-items: center;
  color: #65766f;
  font-size: 11px;
  border: 1px dashed #2a3b36;
}

.element-fire {
  border-left-color: #dc6958 !important;
}
.element-ice {
  border-left-color: #8ed2e8 !important;
}
.element-wind {
  border-left-color: #61b880 !important;
}
.element-earth {
  border-left-color: #c39b56 !important;
}
.element-lightning {
  border-left-color: #9c82d7 !important;
}
.element-water {
  border-left-color: #528ecb !important;
}
.element-light {
  border-left-color: #eee5ba !important;
}
.element-dark {
  border-left-color: #8b7c97 !important;
}
.element-multi {
  border-left-color: #e09c65 !important;
}

.lobby-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 560px);
  gap: 50px;
  align-items: center;
  margin-bottom: 55px;
}
.lobby-heading h1 {
  font-size: clamp(44px, 5vw, 68px);
}
.players-status {
  display: grid;
  gap: 8px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  background: rgba(16, 27, 24, 0.8);
}
.player-chip > span {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--gold);
  font-family: Georgia, serif;
  border: 1px solid #4b5d57;
  border-radius: 50%;
}
.player-chip b,
.player-chip small {
  display: block;
}
.player-chip b {
  font-size: 13px;
}
.player-chip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.09em;
}
.player-chip.ready {
  border-color: #376b57;
}
.player-chip.ready > span {
  color: #b9f2d9;
  border-color: var(--green);
  background: rgba(55, 126, 94, 0.22);
}
.player-chip.waiting {
  opacity: 0.62;
}
.start-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 48px;
  padding: 25px 28px;
}
.start-match h2 {
  margin-bottom: 4px;
  font-size: 25px;
}
.start-match p {
  margin-bottom: 0;
  font-size: 12px;
}
.waiting-host {
  margin-top: 30px;
  color: var(--muted);
  text-align: center;
}
.bot-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 0 10px;
  padding: 20px;
}
.bot-picker h2,
.bot-picker p {
  margin-bottom: 0;
}
.bot-picker p {
  margin-top: 5px;
  font-size: 10px;
}
.bot-remove {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}
.deck-manager-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.deck-manager-heading h1 {
  margin-bottom: 8px;
}
.deck-manager-heading p {
  margin-bottom: 0;
}
.deck-manager-actions {
  display: flex;
  gap: 9px;
}
.deck-import-button {
  cursor: pointer;
}
.deck-manager-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.saved-decks {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 7px;
  padding: 16px;
  box-shadow: none;
}
.saved-deck {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 34px;
  border: 1px solid #2b4039;
  background: #0d1714;
}
.saved-deck.active {
  border-color: var(--gold);
  background: #1b2119;
}
.saved-deck > button {
  padding: 11px;
  text-align: left;
  border: 0;
  background: transparent;
}
.saved-deck .export-deck {
  padding: 5px;
  color: var(--gold-bright);
  font-size: 8px;
  text-align: center;
  border-left: 1px solid #2b4039;
}
.saved-deck .export-deck:hover {
  background: #26352b;
}
.saved-deck b,
.saved-deck small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-deck b {
  font-size: 12px;
}
.saved-deck small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}
.saved-deck .delete-deck {
  color: #a97477;
  font-size: 18px;
  text-align: center;
}
.saved-deck .delete-deck:hover {
  color: #ffd1d3;
  background: #46262a;
}
.match-deck-picker {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(340px, 1.25fr);
  gap: 40px;
  align-items: center;
  padding: 28px;
  box-shadow: none;
}
.match-deck-picker h2 {
  font-size: 28px;
}
.match-deck-picker p {
  margin-bottom: 0;
  font-size: 12px;
}
.deck-select-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.deck-select-controls select {
  grid-column: 1 / -1;
}
.deck-select-controls > .deck-import-link {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  cursor: pointer;
}
.deck-select-controls > .deck-import-link:hover {
  color: var(--gold-bright);
}
.selected-deck-summary {
  display: grid;
  gap: 3px;
}
.selected-deck-summary b {
  font-size: 14px;
}
.selected-deck-summary span {
  color: var(--muted);
  font-size: 10px;
}
.selected-deck-ready {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid #3c755e;
  background: #112c22;
}
.selected-deck-ready > span {
  grid-row: 1 / 3;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.selected-deck-ready b {
  font-size: 14px;
}
.selected-deck-ready small {
  color: var(--muted);
}
.selected-deck-ready .btn {
  grid-column: 3;
  grid-row: 1 / 3;
}
.no-saved-deck {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.no-saved-deck .btn {
  text-decoration: none;
}
.no-saved-deck .deck-import-button {
  cursor: pointer;
}

.result-screen {
  width: min(760px, 100%);
  min-height: 520px;
  margin: 50px auto;
  text-align: center;
}
.result-screen h1 {
  margin-top: 45px;
}
.result-screen .button-row {
  justify-content: center;
  margin-top: 35px;
}
.waiting-animation {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 45px;
}
.waiting-animation span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.2s infinite;
}
.waiting-animation span:nth-child(2) {
  animation-delay: 0.16s;
}
.waiting-animation span:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes pulse {
  0%,
  70%,
  100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-7px);
  }
}
.result-log {
  margin-top: 50px;
  padding: 22px;
  text-align: left;
}
.opening-screen {
  width: min(900px, 100%);
  min-height: 540px;
  margin: 30px auto;
  text-align: center;
}
.opening-screen h1 {
  margin: 30px 0 8px;
}
.opening-screen > p {
  max-width: 650px;
  margin: 0 auto 25px;
}
.opening-screen .opening-cards {
  padding: 18px;
  border-color: #527060;
}
.opening-screen .opening-cards .card-strip {
  justify-content: center;
  min-height: 180px;
}
.opening-screen .opening-cards .game-card {
  width: 112px;
  min-width: 112px;
  height: 157px;
}
.opening-screen > .button-row {
  justify-content: center;
  margin-top: 28px;
}
.opening-screen > .locked-banner {
  margin-top: 28px;
}

.match-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 26px;
}
.match-heading h1 {
  margin: 0;
  font-size: clamp(35px, 4vw, 56px);
}
.random-result {
  display: grid;
  min-width: 105px;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--gold);
  background: #171b13;
}
.random-result small {
  color: var(--muted);
  font-size: 9px;
}
.random-result b {
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 30px;
}
.battle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}
.game-board {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #30463f;
  background: rgba(7, 13, 12, 0.72);
  box-shadow: var(--shadow);
}
.board-side {
  padding: 14px;
}
.opponent-side {
  background: linear-gradient(180deg, rgba(64, 34, 37, 0.18), transparent);
}
.self-side {
  background: linear-gradient(0deg, rgba(26, 64, 50, 0.17), transparent);
}
.shared-center {
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(170px, 0.35fr) 1fr;
  align-items: center;
  gap: 12px;
  min-height: 105px;
  margin: 12px 0;
  padding: 8px 14px;
}
.shared-center::before,
.shared-center::after {
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold));
}
.shared-center::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}
.shared-center .vs-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  padding: 3px 9px;
  color: var(--gold);
  font:
    9px Georgia,
    serif;
  letter-spacing: 0.15em;
  background: #0a100e;
  transform: translate(-50%, -50%);
}
.shared-stack {
  grid-column: 2;
  min-width: 0;
  padding: 6px;
  border-color: #755d35;
  background: #15160f;
}
.shared-stack .card-strip {
  min-height: 78px;
}
.shared-stack .game-card {
  width: 58px;
  min-width: 58px;
  height: 79px;
}
.shared-stack .card-strip > .empty-zone {
  min-height: 65px;
}
.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 49px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid #2f443e;
  background: rgba(14, 25, 22, 0.92);
}
.player-bar small,
.player-bar strong {
  display: block;
}
.player-bar small {
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.player-bar strong {
  margin-top: 2px;
  font-size: 14px;
}
.player-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.player-stats span {
  padding: 5px 7px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.09em;
  border: 1px solid #293b36;
}
.player-stats b {
  color: var(--ink);
  font-size: 13px;
}
.player-stats .damage-stat {
  border-color: #684146;
}
.player-stats .damage-stat b,
.danger {
  color: #ff858c !important;
}
.field-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
  min-height: 165px;
}
.play-zone {
  min-width: 0;
  padding: 7px;
  border: 1px solid #233630;
  background: rgba(9, 16, 14, 0.56);
}
.zone-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #899c95;
  font-size: 8px;
  letter-spacing: 0.15em;
}
.zone-title span {
  color: var(--gold);
}
.card-strip {
  display: flex;
  min-height: 122px;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 7px;
  scrollbar-color: #40584f transparent;
  scrollbar-width: thin;
}
.card-strip > .empty-zone {
  width: 100%;
  min-width: 100%;
  min-height: 110px;
}
.public-zones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.public-zones .card-strip {
  min-height: 83px;
}
.public-zones .card-strip > .empty-zone {
  min-height: 70px;
}
.public-zones .game-card {
  width: 60px;
  min-width: 60px;
  height: 82px;
}
.hand-zone {
  margin-top: 8px;
  border-color: #3b604f;
}
.hand-zone .card-strip {
  min-height: 142px;
}
.lb-summary {
  margin-top: 8px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  border: 1px solid #283b35;
}
.lb-summary b {
  color: var(--ink);
  font-size: 13px;
}

.game-card {
  position: relative;
  width: 84px;
  min-width: 84px;
  height: 116px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 1px solid #61746d;
  border-left-width: 4px;
  border-radius: 4px;
  background: linear-gradient(145deg, #293833, #111b18 65%);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
  transition:
    transform 0.15s,
    filter 0.15s;
}
.game-card:not(:disabled):hover {
  z-index: 2;
  border-color: var(--gold);
  transform: translateY(-3px);
}
.game-card:disabled {
  opacity: 1;
}
.game-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game-card.has-image::after {
  position: absolute;
  inset: 45% 0 0;
  content: "";
  background: linear-gradient(transparent, rgba(4, 7, 6, 0.96));
}
.card-title {
  position: absolute;
  right: 5px;
  bottom: 19px;
  left: 6px;
  z-index: 1;
}
.card-title b,
.card-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-title b {
  font-size: 10px;
}
.card-title small {
  margin-top: 2px;
  color: #b5c2bd;
  font-size: 8px;
}
.card-type {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 6px;
  z-index: 1;
  overflow: hidden;
  color: #8ea198;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dull-mark {
  position: absolute;
  top: 4px;
  left: 3px;
  z-index: 3;
  display: none;
  padding: 2px 3px;
  color: white;
  font-size: 7px;
  background: #9b4b51;
}
.game-card.dull {
  filter: saturate(0.55) brightness(0.72);
  transform: rotate(7deg) scale(0.92);
}
.game-card.dull .dull-mark {
  display: block;
}

.battle-sidebar {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 88px;
}
.control-panel {
  padding: 16px;
  box-shadow: none;
}
.control-panel h3 {
  margin-bottom: 11px;
}
.phase-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 9px;
}
.phase-buttons button,
.button-grid button {
  min-height: 34px;
  padding: 5px;
  color: var(--muted);
  font-size: 9px;
  border: 1px solid #30443e;
  background: #101b18;
}
.phase-buttons button.active {
  color: #17140c;
  border-color: var(--gold);
  background: var(--gold);
}
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.button-grid button:hover {
  color: var(--ink);
  border-color: #5c776d;
}
.big-stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  margin-bottom: 9px;
  text-align: center;
}
.big-stepper button {
  height: 38px;
  color: var(--gold-bright);
  border: 1px solid #4e634f;
  background: #111c18;
}
.big-stepper b {
  font:
    27px Georgia,
    serif;
}
.control-panel > .btn + .btn {
  margin-top: 6px;
}
.log-panel {
  max-height: 330px;
  overflow: auto;
}
.action-log {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.action-log li {
  color: #bbc9c4;
  font-size: 10px;
  line-height: 1.55;
}
.action-log time {
  margin-right: 7px;
  color: #65776f;
  font-size: 8px;
}
.result-panel p {
  margin-bottom: 11px;
  font-size: 10px;
  line-height: 1.5;
}
.result-panel .btn {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 10px;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 79;
  background: transparent;
}
.card-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  width: 220px;
  max-height: calc(100vh - 20px);
  padding: 8px;
  overflow: auto;
  border: 1px solid #51675e;
  background: #101a17;
  box-shadow: 0 18px 50px #000;
}
.card-menu > div {
  padding: 8px 7px 11px;
  border-bottom: 1px solid var(--line);
}
.card-menu b,
.card-menu small {
  display: block;
}
.card-menu b {
  font-size: 12px;
}
.card-menu small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.card-menu .card-effect {
  max-height: min(110px, 16vh);
  margin: 9px 0 0;
  padding-right: 6px;
  overflow-y: auto;
  color: #d7dfdb;
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-line;
  scrollbar-color: #526b61 transparent;
  scrollbar-width: thin;
}
.card-menu button {
  padding: 8px 7px;
  text-align: left;
  color: #bbc8c3;
  font-size: 11px;
  border: 0;
  border-bottom: 1px solid #22322d;
  background: transparent;
}
.card-menu button:hover {
  color: var(--gold-bright);
  background: #182721;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 25px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(7px);
}
.library-modal {
  width: min(1050px, 100%);
  max-height: calc(100vh - 50px);
  padding: 24px;
  overflow: auto;
  border: 1px solid #51685f;
  background: #0e1815;
  box-shadow: 0 30px 100px #000;
}
.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
}
.modal-heading h2 {
  font-size: 32px;
}
.icon-button {
  width: 39px;
  height: 39px;
  color: var(--muted);
  font-size: 24px;
  border: 1px solid var(--line);
  background: transparent;
}
.library-modal > p {
  margin: 8px 0;
  font-size: 10px;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 9px;
  min-height: 160px;
  padding: 15px 0;
}
.search-grid .game-card {
  width: 100%;
  min-width: 0;
  height: 132px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 15px;
}

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hero-copy {
    padding-top: 30px;
  }
  .battle-layout {
    grid-template-columns: 1fr;
  }
  .deck-manager-layout {
    grid-template-columns: 1fr;
  }
  .saved-decks {
    position: static;
  }
  .battle-sidebar {
    position: static;
    grid-template-columns: repeat(2, 1fr);
  }
  .log-panel,
  .result-panel {
    max-height: none;
  }
}

@media (max-width: 760px) {
  main {
    width: min(100% - 22px, 1600px);
    padding-top: 32px;
  }
  .site-header {
    min-height: 64px;
    padding-inline: 12px;
  }
  .brand b {
    font-size: 14px;
  }
  .brand small {
    display: none;
  }
  .brand::before {
    width: 31px;
    height: 31px;
  }
  .room-tools {
    gap: 8px;
  }
  .room-tools .room-code {
    border: 0;
    padding: 0;
  }
  .room-tools .text-button:first-of-type {
    display: none;
  }
  .hero {
    gap: 38px;
    margin-bottom: 65px;
  }
  .hero h1 {
    font-size: 43px;
  }
  .entry-grid,
  .deck-input-grid,
  .deck-columns,
  .lobby-heading {
    grid-template-columns: 1fr;
  }
  .entry-card {
    min-height: 0;
  }
  .section-heading {
    align-items: start;
    flex-direction: column;
  }
  .deck-totals {
    width: 100%;
  }
  .deck-totals span {
    flex: 1;
  }
  .form-pair {
    grid-template-columns: 1fr;
  }
  .deck-import-columns {
    grid-template-columns: 1fr;
  }
  .lobby-heading {
    gap: 18px;
  }
  .deck-manager-heading,
  .match-deck-picker {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
  .deck-manager-heading {
    flex-direction: column;
  }
  .deck-manager-actions {
    width: 100%;
    flex-direction: column;
  }
  .deck-manager-heading .btn {
    width: 100%;
  }
  .deck-select-controls {
    grid-template-columns: 1fr;
  }
  .deck-select-controls > * {
    grid-column: 1 !important;
  }
  .selected-deck-ready {
    grid-template-columns: 1fr;
  }
  .selected-deck-ready > span,
  .selected-deck-ready .btn {
    grid-column: 1;
    grid-row: auto;
  }
  .start-match {
    align-items: stretch;
    flex-direction: column;
  }
  .bot-picker {
    align-items: stretch;
    flex-direction: column;
  }
  .battle-sidebar {
    grid-template-columns: 1fr;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .public-zones {
    grid-template-columns: 1fr 1fr;
  }
  .shared-center {
    grid-template-columns: 0.35fr 1fr 0.35fr;
    padding-inline: 8px;
  }
  .player-bar {
    align-items: start;
    flex-direction: column;
  }
  .player-stats {
    justify-content: flex-start;
  }
  .board-side {
    padding: 8px;
  }
  .match-heading {
    align-items: start;
  }
  footer {
    flex-direction: column;
  }
}
