:root {
  --bg: #111412;
  --panel: #1d211f;
  --panel-2: #252b28;
  --text: #f5f1e8;
  --muted: #b9b2a5;
  --line: #393f3a;
  --gold: #f1c75b;
  --fire: #e4572e;
  --water: #3b8edb;
  --earth: #8fb55f;
  --air: #d9d2bd;
  --electric: #f4d84f;
  --nocturne: #8d65d7;
  --danger: #d85d5d;
  --ok: #6fcf97;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(244, 216, 79, 0.10), transparent 32rem),
    linear-gradient(135deg, #111412, #181c1a 48%, #231f1b);
  color: var(--text);
}

.intro-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #000;
}

.intro-loader.hidden {
  pointer-events: none;
  animation: intro-out 420ms ease forwards;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.intro-video.hidden {
  display: none;
}

.logo-loading {
  display: grid;
  width: min(760px, 86vw);
  gap: 1.4rem;
  justify-items: center;
}

.logo-loading[hidden] {
  display: none;
}

.logo-loading img {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.6));
}

.loading-bar {
  width: min(520px, 82vw);
  height: 0.8rem;
  overflow: hidden;
  border: 1px solid #6b5b35;
  border-radius: 999px;
  background: #090b0f;
  box-shadow: 0 0 24px rgba(241, 199, 91, 0.22);
}

.loading-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6fa6ff, #f1c75b, #fff2a8);
  transform-origin: left;
  animation: loading-fill 3.6s ease forwards;
}

@keyframes loading-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes intro-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(17, 20, 18, 0.88);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  background: transparent;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  width: 3.2rem;
  height: 3.2rem;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.player-strip,
.row,
.actions,
.deck-line,
.battle-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.launcher-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(245, 178, 51, 0.82);
  border-radius: 8px;
  color: #ffeeb4;
  background: linear-gradient(180deg, rgba(64, 16, 22, 0.92), rgba(11, 16, 28, 0.92));
  box-shadow: 0 0 16px rgba(245, 178, 51, 0.16);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.launcher-link:hover {
  transform: translateY(-1px);
  border-color: #f7d36b;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}

.notification-bell {
  position: relative;
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid rgba(241, 199, 91, 0.54);
  border-radius: 8px;
  color: #ffeeb4;
  background: linear-gradient(180deg, rgba(37, 43, 40, 0.98), rgba(12, 14, 13, 0.98));
  box-shadow: 0 0 14px rgba(241, 199, 91, 0.12);
}

.notification-bell.has-notifications {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(241, 199, 91, 0.28);
}

.notification-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.15rem;
  min-height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  color: #fff;
  background: #d12f2f;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15rem;
}

.notification-list {
  display: grid;
  gap: 0.65rem;
  max-height: 52vh;
  overflow: auto;
}

.notification-line {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid rgba(241, 199, 91, 0.24);
  border-radius: 8px;
  background: rgba(10, 13, 12, 0.42);
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(0.85rem, 2.5vw, 1.5rem) 3rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0 1rem;
}

.tab,
.primary,
.secondary,
.danger,
.icon-btn {
  min-height: 2.45rem;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tab:hover,
.primary:hover,
.secondary:hover,
.danger:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: #705f35;
}

.tab.active,
.primary {
  background: linear-gradient(145deg, #c38a30, #6b451b);
  border-color: #f1c75b;
  color: #fff7df;
}

.secondary {
  background: var(--panel-2);
}

.small-btn {
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
}

.danger {
  background: #572726;
  border-color: #8c3b39;
}

.stack-list,
.match-log {
  display: grid;
  gap: 0.65rem;
}

.social-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem;
  border: 1px solid rgba(241, 199, 91, 0.22);
  border-radius: 8px;
  background: rgba(10, 13, 12, 0.28);
}

.conversation-preview,
.conversation-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(241, 199, 91, 0.24);
  border-radius: 8px;
  background: rgba(10, 13, 12, 0.42);
  color: var(--text);
  text-align: left;
}

.conversation-preview span,
.conversation-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(195, 138, 48, 0.36), rgba(37, 43, 40, 0.92));
  box-shadow: 0 0 18px rgba(241, 199, 91, 0.14);
}

.messenger-modal {
  min-height: min(680px, calc(100vh - 2.5rem));
}

.messenger-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  min-height: 520px;
}

.conversation-sidebar,
.conversation-thread {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.conversation-list {
  display: grid;
  gap: 0.55rem;
  max-height: 520px;
  overflow: auto;
  padding-right: 0.2rem;
}

.message-thread {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  min-height: 360px;
  max-height: 440px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid rgba(241, 199, 91, 0.16);
  border-radius: 8px;
  background: rgba(7, 9, 8, 0.38);
}

.chat-bubble {
  display: grid;
  gap: 0.25rem;
  max-width: min(76%, 620px);
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(241, 199, 91, 0.18);
  border-radius: 8px;
  background: rgba(29, 33, 31, 0.92);
}

.chat-bubble.mine {
  justify-self: end;
  border-color: rgba(111, 207, 151, 0.38);
  background: rgba(31, 58, 45, 0.88);
}

.chat-bubble strong {
  color: #ffeeb4;
  font-size: 0.86rem;
}

.message-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.group-member-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem;
  max-height: 220px;
  overflow: auto;
}

.online-match {
  margin-top: 1rem;
  border-color: rgba(241, 199, 91, 0.48);
  box-shadow: 0 0 24px rgba(241, 199, 91, 0.12);
}

.duel-life-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.8rem 0;
  color: #ffeeb4;
  font-weight: 800;
}

.match-log p {
  margin: 0;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero,
.section,
.duel-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 33, 31, 0.86);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(1rem, 4vw, 2.5rem);
  align-items: center;
  min-height: 420px;
  padding: clamp(1.25rem, 4vw, 3rem);
  overflow: hidden;
}

.hero h1,
.section h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 10ch;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 0.92;
}

.hero p,
.muted {
  color: var(--muted);
}

.hero-board {
  position: relative;
  height: min(560px, 72vh);
  overflow: hidden;
  transform: rotate(-2deg);
}

.hero-board::before,
.hero-board::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 5rem;
  pointer-events: none;
}

.hero-board::before {
  top: 0;
  background: linear-gradient(180deg, rgba(29, 33, 31, 0.95), transparent);
}

.hero-board::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(29, 33, 31, 0.95), transparent);
}

.carousel-track {
  display: grid;
  gap: 0.85rem;
  animation: vertical-card-ribbon 34s linear infinite;
}

.showcase-card {
  min-height: 300px;
}

.showcase-card .card-art {
  min-height: 252px;
  background-size: contain;
  background-repeat: no-repeat;
  background-color: #0d0f0e;
}

.showcase-card .card-body {
  padding: 0.45rem 0.6rem;
}

.showcase-card .card-meta,
.showcase-card .stars {
  display: none;
}

.carousel-board:hover .carousel-track {
  animation-play-state: paused;
}

@keyframes vertical-card-ribbon {
  from { transform: translateY(0); }
  to { transform: translateY(calc(-50% - 0.425rem)); }
}

.section {
  margin-top: 1rem;
  padding: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
}

.card {
  position: relative;
  display: grid;
  min-height: 268px;
  overflow: hidden;
  border: 1px solid #6b5b35;
  border-radius: 8px;
  background: #171917;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.card.shiny-legendary {
  border-color: #ffe27a;
  box-shadow: 0 0 0 2px rgba(255, 226, 122, 0.45), 0 0 32px rgba(170, 91, 255, 0.5), 0 18px 42px rgba(0, 0, 0, 0.36);
}

.card.shiny-legendary::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.75) 47%, transparent 58%);
  animation: shiny-sweep 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shiny-sweep {
  from { transform: translateX(-55%) rotate(8deg); }
  to { transform: translateX(55%) rotate(8deg); }
}

.card.compact {
  min-height: 210px;
}

.card.face-down .card-art {
  background:
    linear-gradient(135deg, rgba(241, 199, 91, 0.35), rgba(141, 101, 215, 0.18)),
    repeating-linear-gradient(45deg, #1f2420, #1f2420 9px, #2c332e 9px, #2c332e 18px);
  background-color: #09080f;
  background-repeat: no-repeat;
  background-size: contain;
}

.card.face-down .card-name::after {
  content: "Dos Monster Card";
}

.card-art {
  min-height: 160px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), transparent),
    var(--element-color, #767676);
  background-size: cover;
  background-position: center;
}

.card-body {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.75rem;
  background: linear-gradient(180deg, rgba(12, 13, 12, 0.65), #171917);
}

.card-name {
  font-weight: 800;
}

.card-meta,
.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.stars {
  color: var(--gold);
  letter-spacing: 0;
}

.element-Terre { --element-color: var(--earth); }
.element-Feu { --element-color: var(--fire); }
.element-Eau { --element-color: var(--water); }
.element-Air { --element-color: var(--air); color: #151515; }
.element-Electricite { --element-color: var(--electric); color: #191509; }
.element-Nocturne { --element-color: var(--nocturne); }

.panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-content: center;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.inline-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #111412;
  color: var(--text);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.duel-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  padding: 1rem;
}

#duelMount.duel-fullscreen,
#duelMount.duel-compact {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: auto;
  padding: 0.75rem;
  background: #07090d;
}

#duelMount.duel-fullscreen .duel-shell,
#duelMount.duel-compact .duel-shell {
  width: min(1560px, 100%);
  min-height: calc(100vh - 4.25rem);
  margin: 3.35rem auto 0;
}

#duelMount.duel-reduced {
  position: relative;
}

#duelMount.duel-compact .duel-shell {
  width: min(1120px, 100%);
  transform: scale(0.88);
  transform-origin: top center;
}

.duel-window-controls {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0.45rem;
  border: 1px solid rgba(126, 148, 180, 0.45);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.9);
  backdrop-filter: blur(10px);
}

#duelMount.duel-fullscreen .duel-window-controls,
#duelMount.duel-compact .duel-window-controls {
  position: fixed;
  top: 0.55rem;
  right: 0.75rem;
  left: 0.75rem;
  width: auto;
}

.battlefield {
  display: grid;
  gap: 1rem;
}

.combat-board {
  position: relative;
  overflow: hidden;
  min-height: 720px;
  padding: 0.9rem;
  border: 1px solid #3c465a;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(223, 40, 48, 0.24), transparent 25%, transparent 75%, rgba(223, 40, 48, 0.22)),
    radial-gradient(circle at 50% 49%, rgba(255, 222, 77, 0.72), rgba(255, 126, 34, 0.18) 16%, transparent 34%),
    linear-gradient(180deg, rgba(30, 43, 68, 0.82), rgba(9, 11, 16, 0.94) 46%, rgba(31, 42, 58, 0.86)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 14px);
  box-shadow: inset 0 0 46px rgba(0, 0, 0, 0.65);
}

.combat-board::before,
.combat-board::after {
  content: "";
  position: absolute;
  left: -4rem;
  right: -4rem;
  height: 4px;
  background: linear-gradient(90deg, transparent, #e33434 18%, #dce8ff 50%, #e33434 82%, transparent);
  box-shadow: 0 0 18px rgba(227, 52, 52, 0.8);
  pointer-events: none;
}

.combat-board::before {
  top: 31%;
}

.combat-board::after {
  bottom: 27%;
}

.combat-title {
  justify-self: center;
  min-width: min(460px, 90%);
  padding: 0.45rem 1rem;
  border: 1px solid #6d7890;
  border-radius: 8px;
  background: linear-gradient(180deg, #202d49, #0c111d);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(226, 44, 54, 0.6);
  text-align: center;
  font-weight: 900;
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.player-title {
  margin-top: 0.4rem;
}

.turn-console {
  justify-self: center;
  width: min(620px, 100%);
  padding: 0.65rem;
  border: 1px solid rgba(230, 232, 245, 0.3);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.78);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.duel-matchups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.duel-matchups span {
  min-height: 1.9rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid rgba(126, 148, 180, 0.42);
  border-radius: 6px;
  background: rgba(5, 8, 13, 0.7);
  color: var(--text);
  text-align: center;
  font-size: 0.82rem;
  white-space: nowrap;
}

.combatant-zone {
  position: relative;
  border-style: solid;
  border-color: rgba(126, 148, 180, 0.52);
  background:
    linear-gradient(90deg, rgba(226, 38, 48, 0.16), transparent 30%, transparent 70%, rgba(226, 38, 48, 0.16)),
    rgba(7, 10, 15, 0.58);
}

.enemy-zone {
  box-shadow: inset 0 -4px 0 rgba(214, 39, 48, 0.6);
}

.player-zone {
  box-shadow: inset 0 4px 0 rgba(124, 210, 74, 0.45);
}

.combatant-name {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text);
}

.combatant-name span {
  color: var(--muted);
}

.combat-line {
  display: grid;
  grid-template-columns: 104px minmax(130px, 190px) minmax(250px, 1fr) 104px;
  gap: 0.8rem;
  align-items: end;
}

.combat-slot,
.combat-pile,
.player-hand-panel {
  display: grid;
  gap: 0.35rem;
}

.combat-label {
  min-height: 1.75rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid #657089;
  border-radius: 6px;
  background: linear-gradient(180deg, #24324d, #0c111d);
  color: #f2f6ff;
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.attack-slot .combat-label {
  border-color: #c74949;
  box-shadow: inset 0 -2px 0 rgba(210, 49, 49, 0.7);
}

.player-zone .attack-slot .combat-label {
  border-color: #74b95e;
  box-shadow: inset 0 -2px 0 rgba(91, 197, 89, 0.65);
}

.defense-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 0.55rem;
}

.combat-line .slot-card {
  min-height: 142px;
  padding: 0.3rem;
}

.attack-card .card,
.defense-card .card,
.hand-card .card {
  min-height: 132px;
}

.combat-line .card-art {
  min-height: 88px;
}

.combat-line .card-body {
  padding: 0.45rem;
}

.combat-line .card-meta {
  display: none;
}

.combat-pile {
  justify-items: center;
}

.pile-card {
  display: grid;
  width: 88px;
  height: 124px;
  place-items: center;
  border: 1px solid #68758d;
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.8);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.mini-card-back {
  width: 76px;
  height: 108px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
}

.discard .pile-card span {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 999px;
  background: #202632;
  color: var(--muted);
  font-weight: 900;
}

.pile-count {
  color: var(--muted);
  font-size: 0.86rem;
}

.player-hand-panel {
  width: min(720px, 100%);
  justify-self: center;
  margin-top: 0.55rem;
}

.hand-label {
  justify-self: center;
  min-width: min(360px, 100%);
}

.player-hand-panel .hand {
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  padding: 0.55rem;
  border: 1px solid rgba(126, 148, 180, 0.5);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.68);
}

.player-hand-panel .slot-card {
  min-height: 130px;
}

.player-hand-panel .card-art {
  min-height: 82px;
}

.player-hand-panel .card-body {
  padding: 0.4rem;
}

.player-hand-panel .card-meta,
.player-hand-panel .stars {
  display: none;
}

.combat-log-panel {
  align-self: stretch;
}

.setup-board > .panel {
  justify-self: center;
  width: min(720px, 100%);
  background: rgba(7, 10, 15, 0.78);
}

.setup-board > .zone:not(.combatant-zone) {
  width: min(760px, 100%);
  justify-self: center;
  border-style: solid;
  border-color: rgba(126, 148, 180, 0.52);
  background: rgba(7, 10, 15, 0.62);
}

.setup-board > .zone:not(.combatant-zone) .slots {
  grid-template-columns: minmax(130px, 190px) repeat(3, minmax(86px, 1fr));
  align-items: end;
}

.setup-board > .zone:not(.combatant-zone) .hand {
  grid-template-columns: repeat(5, minmax(96px, 1fr));
}

.setup-board > .actions {
  justify-self: center;
}

.duel-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.duel-result-box {
  width: min(420px, 100%);
  padding: 1.25rem;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(180deg, #242b34, #111418);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62), 0 0 26px rgba(241, 199, 91, 0.24);
  text-align: center;
}

.duel-result-box h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(2rem, 6vw, 3.5rem);
}

#duelMount.duel-force-mobile .combat-board {
  min-height: auto;
  padding: 0.55rem;
  background:
    linear-gradient(180deg, rgba(3, 5, 8, 0.08), rgba(3, 5, 8, 0.14)),
    url("assets/boards/plateau-mobile.png");
  background-size: cover;
  background-position: top center;
}

#duelMount.duel-force-mobile .combat-line {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#duelMount.duel-force-mobile .defense-slot {
  grid-column: 1 / -1;
}

#duelMount.duel-force-mobile .defense-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#duelMount.duel-force-mobile .combat-pile {
  display: none;
}

#duelMount.duel-force-mobile .player-hand-panel .hand {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#duelMount.duel-force-mobile .combatant-zone,
#duelMount.duel-force-mobile .turn-console,
#duelMount.duel-force-mobile .setup-board > .panel,
#duelMount.duel-force-mobile .setup-board > .zone:not(.combatant-zone),
#duelMount.duel-force-mobile .player-hand-panel .hand {
  background: rgba(7, 10, 15, 0.48);
  backdrop-filter: blur(2px);
}

#duelMount.duel-force-mobile .combat-title {
  background: rgba(10, 16, 28, 0.72);
}

#duelMount.duel-force-mobile .duel-matchups {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#duelMount.duel-force-mobile .duel-shell {
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding: 0.35rem;
}

#duelMount.duel-force-mobile .combat-board {
  gap: 0.42rem;
  min-height: auto;
}

#duelMount.duel-force-mobile .combat-title {
  min-width: 0;
  width: 100%;
  padding: 0.25rem 0.55rem;
  font-size: 1rem;
}

#duelMount.duel-force-mobile .zone {
  gap: 0.35rem;
  padding: 0.42rem;
}

#duelMount.duel-force-mobile .combatant-name {
  font-size: 0.78rem;
}

#duelMount.duel-force-mobile .combat-label {
  min-height: 1.35rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.68rem;
}

#duelMount.duel-force-mobile .combat-line {
  gap: 0.35rem;
}

#duelMount.duel-force-mobile .defense-row {
  gap: 0.25rem;
}

#duelMount.duel-force-mobile .combat-line .slot-card,
#duelMount.duel-force-mobile .player-hand-panel .slot-card {
  min-height: 92px;
  padding: 0.18rem;
}

#duelMount.duel-force-mobile .attack-card .card,
#duelMount.duel-force-mobile .defense-card .card,
#duelMount.duel-force-mobile .hand-card .card,
#duelMount.duel-force-mobile .slot-card .card {
  min-height: 86px;
}

#duelMount.duel-force-mobile .combat-line .card-art,
#duelMount.duel-force-mobile .player-hand-panel .card-art {
  min-height: 58px;
}

#duelMount.duel-force-mobile .card-body {
  padding: 0.24rem;
}

#duelMount.duel-force-mobile .card-name {
  font-size: 0.68rem;
}

#duelMount.duel-force-mobile .stars {
  font-size: 0.72rem;
}

#duelMount.duel-force-mobile .turn-console,
#duelMount.duel-force-mobile .setup-board > .panel {
  padding: 0.42rem;
}

#duelMount.duel-force-mobile .turn-console p,
#duelMount.duel-force-mobile .setup-board > .panel p,
#duelMount.duel-force-mobile .duel-matchups {
  display: none;
}

#duelMount.duel-force-mobile .battle-meta {
  gap: 0.35rem;
  font-size: 0.78rem;
}

#duelMount.duel-force-mobile .player-hand-panel {
  margin-top: 0.25rem;
}

#duelMount.duel-force-mobile .player-hand-panel .hand {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.28rem;
  padding: 0.35rem;
}

#duelMount.duel-force-mobile .combat-log-panel {
  max-height: 190px;
}

#duelMount.duel-force-mobile .battle-log {
  height: 150px;
}

@media (orientation: portrait) {
  #duelMount.duel-force-mobile.duel-fullscreen,
  #duelMount.duel-force-mobile.duel-compact {
    overflow: hidden;
  }

  #duelMount.duel-force-mobile .duel-window-controls {
    left: 0.35rem;
    right: 0.35rem;
    top: 0.35rem;
    transform: none;
  }

  #duelMount.duel-force-mobile .duel-shell {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vh;
    height: calc(100vw - 4.2rem);
    min-height: 0;
    margin: 0;
    overflow: auto;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
  }

  #duelMount.duel-force-mobile .combat-board {
    min-height: 100%;
  }

  #duelMount.duel-force-mobile .combat-log-panel {
    display: none;
  }
}

.zone {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px dashed #4c554d;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.slots,
.hand {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 0.65rem;
}

.slot-card {
  min-height: 164px;
  border: 1px solid #594d36;
  border-radius: 8px;
  background: #151816;
}

.slot-card.selectable,
.card.selectable {
  outline: 2px solid transparent;
}

.slot-card.selectable:hover,
.card.selectable:hover {
  outline-color: var(--gold);
}

.slot-card[data-defense] {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(241, 199, 91, 0.35), 0 12px 24px rgba(0, 0, 0, 0.22);
}

.slot-card[data-defense]:hover {
  transform: translateY(-2px);
}

.card.is-attacking {
  animation: strike-card 620ms ease both;
  z-index: 2;
}

.card.is-hit {
  animation: hit-card 620ms ease both;
}

@keyframes strike-card {
  0% { transform: translateX(0) scale(1); filter: brightness(1); }
  42% { transform: translateX(18px) scale(1.04); filter: brightness(1.35); }
  100% { transform: translateX(0) scale(1); filter: brightness(1); }
}

@keyframes hit-card {
  0% { transform: rotate(0) scale(1); opacity: 1; }
  35% { transform: rotate(-2deg) scale(1.05); filter: brightness(1.55); }
  100% { transform: rotate(5deg) scale(0.92); opacity: 0.55; filter: brightness(0.75); }
}

.battle-log {
  height: min(62vh, 560px);
  max-height: 560px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.25rem 0.25rem 1rem;
  overscroll-behavior: contain;
}

.log-line {
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171917;
}

.timer {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.booster {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  border: 1px solid #6c5730;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(241, 199, 91, 0.22), transparent),
    var(--panel);
}

.booster-image {
  width: min(210px, 100%);
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.35));
}

.booster-info,
.shop-booster {
  justify-items: center;
  text-align: center;
}

.shop-booster {
  align-content: start;
}

.booster-quantity {
  display: grid;
  gap: 0.35rem;
  width: min(180px, 100%);
  color: var(--muted);
  font-weight: 800;
}

.booster-quantity input {
  min-height: 42px;
  border: 1px solid rgba(220, 169, 53, 0.52);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.88);
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-align: center;
}

.booster-total {
  min-height: 22px;
  color: var(--gold);
  font-weight: 800;
}

.booster.opening {
  animation: tear 850ms ease both;
}

@keyframes tear {
  0% { clip-path: inset(0); transform: scale(1); }
  55% { clip-path: polygon(0 0, 48% 0, 52% 18%, 100% 0, 100% 100%, 0 100%); transform: scale(1.04) rotate(-1deg); }
  100% { clip-path: polygon(0 0, 45% 0, 55% 25%, 100% 0, 100% 100%, 0 100%); transform: scale(0.96) rotate(1deg); opacity: 0.28; }
}

.modal {
  width: min(620px, calc(100vw - 1.5rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

.modal.wide {
  width: min(980px, calc(100vw - 1.5rem));
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.modal-content {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.big-card {
  width: min(360px, 100%);
  margin: 0 auto;
}

.full-card-view {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(220px, 1fr);
  gap: 1rem;
  align-items: start;
}

.full-card-image {
  width: 100%;
  max-height: min(76vh, 720px);
  object-fit: contain;
  border: 1px solid #6b5b35;
  border-radius: 8px;
  background: #0d0f0e;
}

.status-ok {
  color: var(--ok);
}

.status-danger {
  color: var(--danger);
}

.account-avatar {
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
}

.tutorial-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.matchup-card {
  gap: 0.35rem;
}

.matchup-card strong {
  font-size: 1.05rem;
}

.deck-rule-counter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deck-rule-counter span,
.deck-builder-badge {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111412;
  font-size: 0.86rem;
}

.manual-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  max-height: 620px;
  overflow: auto;
  padding-right: 0.25rem;
}

.deck-builder-card {
  position: relative;
  display: grid;
  gap: 0.35rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111412;
  color: var(--text);
  text-align: left;
}

.deck-builder-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(241, 199, 91, 0.22);
}

.deck-builder-card .card {
  min-height: 220px;
  box-shadow: none;
}

.deck-builder-card .card-art {
  min-height: 132px;
}

.deck-builder-badge {
  justify-self: center;
  margin: 0 0 0.55rem;
}

.preview-card-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.avatar-preview {
  display: grid;
  width: 6rem;
  height: 6rem;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111412;
  color: var(--muted);
  text-align: center;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .duel-shell {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: clamp(3rem, 18vw, 5rem);
  }

  .slots,
  .hand {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .combat-board {
    min-height: auto;
    padding: 0.55rem;
    background:
      linear-gradient(180deg, rgba(3, 5, 8, 0.08), rgba(3, 5, 8, 0.14)),
      url("assets/boards/plateau-mobile.png");
    background-size: cover;
    background-position: top center;
  }

  .combat-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .combatant-zone,
  .turn-console,
  .setup-board > .panel,
  .setup-board > .zone:not(.combatant-zone),
  .player-hand-panel .hand {
    background: rgba(7, 10, 15, 0.48);
    backdrop-filter: blur(2px);
  }

  .combat-title {
    background: rgba(10, 16, 28, 0.72);
  }

  .duel-matchups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .duel-shell {
    gap: 0.45rem;
    padding: 0.35rem;
  }

  .combat-board {
    gap: 0.42rem;
  }

  .combat-title {
    min-width: 0;
    width: 100%;
    padding: 0.25rem 0.55rem;
    font-size: 1rem;
  }

  .combat-line {
    gap: 0.35rem;
  }

  .defense-row {
    gap: 0.25rem;
  }

  .combat-line .slot-card,
  .player-hand-panel .slot-card {
    min-height: 92px;
    padding: 0.18rem;
  }

  .combat-line .card-art,
  .player-hand-panel .card-art {
    min-height: 58px;
  }

  .player-hand-panel .hand {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.28rem;
    padding: 0.35rem;
  }

  .turn-console p,
  .duel-matchups {
    display: none;
  }

  .defense-slot {
    grid-column: 1 / -1;
  }

  .defense-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .combat-pile {
    display: none;
  }

  .player-hand-panel .hand {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .full-card-view {
    grid-template-columns: 1fr;
  }

  .messenger-layout,
  .message-compose {
    grid-template-columns: 1fr;
  }

  .messenger-modal {
    min-height: auto;
  }

  .conversation-list,
  .message-thread {
    max-height: 44vh;
  }

  .chat-bubble {
    max-width: 94%;
  }

  .account-avatar {
    grid-template-columns: 1fr;
  }
}

.trade-panel {
  border-color: rgba(241, 199, 91, 0.32);
  background:
    linear-gradient(145deg, rgba(29, 23, 13, 0.88), rgba(12, 16, 20, 0.94)),
    radial-gradient(circle at 20% 0%, rgba(241, 199, 91, 0.12), transparent 34%);
}

.trade-showcase-grid,
.trade-offer-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.trade-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid rgba(241, 199, 91, 0.3);
  border-radius: 10px;
  background: rgba(8, 11, 14, 0.82);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.28);
}

.trade-card.collection-trade-card {
  position: relative;
}

.trade-card.collection-trade-card.in-showcase {
  border-color: rgba(78, 202, 125, 0.7);
  box-shadow: 0 0 0 2px rgba(78, 202, 125, 0.16), inset 0 0 20px rgba(0, 0, 0, 0.28);
}

.trade-card .card {
  min-height: 215px;
  box-shadow: none;
}

.trade-card .card-art {
  min-height: 128px;
}

.trade-card-actions,
.trade-search,
.trade-basket,
.trade-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.trade-card-actions button,
.trade-basket button {
  flex: 1 1 auto;
}

.trade-search input {
  min-width: min(100%, 240px);
}

.trade-basket {
  justify-content: space-between;
  margin: 0.75rem 0;
  padding: 0.7rem;
  border: 1px solid rgba(241, 199, 91, 0.26);
  border-radius: 10px;
  background: rgba(241, 199, 91, 0.08);
}

.trade-basket span {
  color: var(--gold);
  font-weight: 700;
}

.wide-trade-modal {
  width: min(1120px, 94vw);
}

.trade-offer-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.trade-mini-list span {
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(241, 199, 91, 0.26);
  border-radius: 999px;
  background: rgba(241, 199, 91, 0.08);
  color: var(--gold);
  font-weight: 700;
}

.trade-offer-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.5rem;
  border: 1px solid rgba(241, 199, 91, 0.22);
  border-radius: 10px;
  background: rgba(8, 11, 14, 0.82);
  color: var(--text);
  cursor: pointer;
}

.trade-offer-card.selected {
  border-color: rgba(78, 202, 125, 0.82);
  background: rgba(23, 72, 43, 0.5);
  box-shadow: 0 0 0 2px rgba(78, 202, 125, 0.18);
}

.trade-offer-card .card {
  min-height: 195px;
}

.trade-offer-card span {
  justify-self: center;
  color: var(--gold);
  font-weight: 800;
}

.trade-offer-message {
  display: grid;
  gap: 0.42rem;
  min-width: min(100%, 360px);
  padding: 0.75rem;
  border: 1px solid rgba(241, 199, 91, 0.34);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(75, 37, 9, 0.72), rgba(14, 17, 20, 0.88));
}

.trade-offer-message strong {
  color: var(--gold);
}

@media (max-width: 820px) {
  .trade-offer-layout {
    grid-template-columns: 1fr;
  }

  .trade-showcase-grid,
  .trade-offer-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-trade-modal {
    width: 96vw;
  }
}
