/* Full-page student duel destination (Design 1: Kompakt Arena Akışı), above the previous tab and below the dock. */
#dmDuelHome.dm-duel-page {
  position:fixed; z-index:100000010; inset:0;
  padding:env(safe-area-inset-top,0px) 0 var(--dm-duel-bottom,76px); overflow:hidden; overscroll-behavior:contain;
  background:#f3ebfb; color:#261152; font-family:Nunito,system-ui,sans-serif;
}
#dmDuelHome[hidden] {display:none!important}
#dmDuelHome * {box-sizing:border-box}
.dm-duel-page-inner {
  width:min(100%,540px); min-height:100%; margin:auto;
  padding:clamp(4px,.8dvh,8px) 14px clamp(6px,1.1dvh,12px);
  display:flex; flex-direction:column; justify-content:space-between;
  gap:clamp(6px,1.1dvh,10px);
}
.dm-duel-page-head {
  display:grid; grid-template-columns:1fr auto 1fr; align-items:center;
  min-height:clamp(36px,4.8dvh,44px); padding:0; gap:8px; flex:none;
}
.dm-duel-page-head h1 {font-size:clamp(21px,6.4vw,28px); font-weight:1000; line-height:1; margin:0}
.dm-duel-brand {min-width:0; font-size:clamp(11px,3.1vw,14px); line-height:1.05; font-weight:1000; white-space:nowrap}
.dm-duel-brand small {
  display:table; margin-top:2px; padding:1.5px 7px; border-radius:999px;
  background:#ffdb45; color:#261152; font-size:.72em; font-weight:900;
}
.dm-duel-page-head [data-duel-inbox] {justify-self:end}

/* Compact Hero Card with Live 3D Papi */
#dmDuelHome .dm-duel-arena {
  position:relative; isolation:isolate; overflow:hidden; flex:none;
  display:grid; gap:clamp(6px,1dvh,9px);
  padding:clamp(8px,1.2dvh,11px) 11px clamp(9px,1.3dvh,11px);
  border-radius:20px; border-bottom:4px solid #052834;
  background:radial-gradient(circle at 82% 18%,#0f6f83 0%,#084858 55%,#063542 100%);
  box-shadow:0 0 0 2px #37dfd8,0 8px 20px rgba(8,72,88,.22);
}
#dmDuelHome .dm-duel-arena::after {
  content:""; position:absolute; inset:0; z-index:2; border-radius:inherit;
  box-shadow:inset 0 0 0 2px #88fff1,inset 0 0 22px #27dedb65;
  opacity:.35; pointer-events:none;
  animation:dm-duel-arena-glow 3s ease-in-out infinite;
}
.dm-duel-hero-stage {
  position:relative; z-index:1;
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:9px;
  padding:0 2px;
}
.dm-duel-papi-slot {
  width:clamp(56px,9.4dvh,78px); aspect-ratio:400/440; flex:none;
  position:relative; display:flex; align-items:center; justify-content:center;
  filter:drop-shadow(0 5px 10px rgba(4,24,32,.35));
}
.dm-duel-papi-slot svg.dmp {width:100%; height:100%; display:block; cursor:pointer}
.dm-duel-papi-fallback {width:100%; height:100%; object-fit:contain; display:block}
.dm-duel-hero-copy {min-width:0; color:#fff}
.dm-duel-live-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:1.5px 7px; border-radius:999px; margin-bottom:3px;
  background:rgba(255,212,38,.18); border:1px solid rgba(255,212,38,.42);
  color:#ffe875; font-size:10.5px; font-weight:800; line-height:1.2;
}
.dm-duel-live-dot {
  width:6px; height:6px; border-radius:50%; background:#4ade80;
  box-shadow:0 0 6px #4ade80;
}
.dm-duel-hero-copy h2 {
  margin:0; font-size:clamp(15px,4.4vw,19px); font-weight:1000;
  line-height:1.12; letter-spacing:-.01em; color:#fff;
}
.dm-duel-vs-cluster {
  position:relative; width:clamp(46px,7dvh,58px); height:clamp(46px,7dvh,58px);
  display:grid; place-items:center; flex:none;
}
.dm-duel-vs-bolt {
  width:100%; height:100%; color:#ffd426;
  filter:drop-shadow(0 4px 10px rgba(255,212,38,.35));
}
.dm-duel-vs-badge {
  position:absolute; right:0; bottom:1px;
  padding:1.5px 6px; border-radius:7px;
  background:#073845; border:2px solid #4ce3e8; color:#fff;
  font-size:10.5px; font-weight:1000; letter-spacing:.04em;
  transform:rotate(-7deg); box-shadow:0 4px 10px rgba(0,0,0,.28);
}

/* Primary 3D Yellow Button */
.dm-duel-quick,.dm-duel-options button,.dm-duel-history,.dm-duel-champ-more {
  cursor:pointer; font-family:inherit;
}
.dm-duel-icon,.dm-duel-chevron {display:block; width:1.15em; height:1.15em; flex:none}
#dmDuelHome .dm-duel-quick {
  position:relative; z-index:1; isolation:isolate; overflow:hidden;
  min-height:clamp(40px,5.5dvh,48px); width:100%;
  display:flex; align-items:center; justify-content:center; gap:7px;
  border:0; border-bottom:4px solid #b98200; border-radius:14px;
  background:linear-gradient(115deg,#ffdf26,#ffca00 65%,#ffe454);
  box-shadow:0 0 12px #ffd00066;
  color:#261152; font-size:clamp(16px,4.6vw,20px); font-weight:1000;
  transition:transform .12s ease;
}
#dmDuelHome .dm-duel-quick:active {transform:translateY(2px)}
#dmDuelHome .dm-duel-quick::after {
  content:""; position:absolute; inset:0 auto 0 -45%; width:32%; z-index:1;
  background:linear-gradient(105deg,transparent,#fffbd7b3,transparent);
  transform:skewX(-24deg); animation:dm-duel-shine 3.6s ease-in-out infinite;
  pointer-events:none;
}

/* 2-Column Mode Grid */
.dm-duel-options {
  display:grid; grid-template-columns:1fr 1fr; gap:9px; flex:none;
}
.dm-duel-options button {
  display:flex; align-items:center; gap:9px;
  min-height:clamp(46px,6.4dvh,54px); padding:clamp(6px,.9dvh,8px) 9px;
  border:1px solid #ece4ff; border-bottom:3.5px solid #dfcef4; border-radius:16px;
  background:#fff; color:#261152; text-align:left;
  font-size:clamp(12px,3.4vw,14px); font-weight:900; line-height:1.15;
  box-shadow:0 3px 10px rgba(49,24,110,.06);
  transition:transform .12s ease,border-color .15s ease;
}
.dm-duel-options button:active {transform:translateY(1px)}
.dm-duel-option-icon {
  display:grid; place-items:center; flex:none;
  width:clamp(32px,4.6dvh,40px); aspect-ratio:1;
  border-bottom:3px solid #bb8200; border-radius:11px;
  background:#ffc600; color:#5327b8;
}
.dm-duel-option-icon .dm-duel-icon {width:62%; height:62%}
.dm-duel-options .dm-duel-face {
  border-bottom-color:#078178;
  background:#0a4253 url("friends-assets/papi-duel-petrol.webp") no-repeat 28% 12% / 365% auto;
}

/* Compact Stats Card + History Link */
.dm-duel-stats-card {
  background:#fff; border:1px solid #ece4ff; border-radius:16px;
  padding:clamp(7px,1dvh,9px) 11px; flex:none;
  box-shadow:0 3px 10px rgba(49,24,110,.06);
}
.dm-duel-stats-head {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  margin-bottom:clamp(4px,.7dvh,6px);
}
.dm-duel-stats-title {font-size:11.5px; font-weight:800; color:#6e5c94}
.dm-duel-history {
  display:inline-flex; align-items:center; gap:2px; padding:1px 0;
  border:0; background:transparent; color:#5b2ec4;
  font-size:11.5px; font-weight:900;
}
.dm-duel-history .dm-duel-chevron {width:13px; height:13px}
#dmDuelHome .dm-duel-personal {
  display:grid; grid-auto-flow:column; grid-auto-columns:1fr; align-items:center;
  min-height:clamp(34px,4.5dvh,40px); text-align:center; font-size:12px; font-weight:700; color:#655581;
}
.dm-duel-personal span {
  display:grid; justify-items:center; gap:1px;
  border-inline-end:1px solid #ede7fa; padding:0 4px;
}
.dm-duel-personal span:last-child {border:0}
.dm-duel-personal .dm-duel-icon {width:17px; height:17px; color:#6332ce}
.dm-duel-personal b {font-size:clamp(14.5px,4.2vw,18px); line-height:1.05; font-weight:1000; color:#261152}
.dm-duel-personal small {font-size:10.5px; font-weight:800; color:#7a6b99}

/* Düello Şampiyonları Card */
.dm-duel-champions {
  position:relative; overflow:hidden; flex:1 0 auto;
  display:flex; flex-direction:column; justify-content:space-between;
  border-radius:20px; padding:clamp(9px,1.3dvh,12px) 12px; color:#fff;
  background:linear-gradient(160deg,#0d5e70 0%,#074454 60%,#053340 100%);
  box-shadow:0 8px 20px rgba(5,51,64,.22);
}
.dm-duel-champions::before {
  content:""; position:absolute; right:-36px; bottom:-36px;
  width:120px; height:120px; border-radius:50%;
  border:10px solid rgba(255,255,255,.05); pointer-events:none;
}
.dm-duel-champ-head {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  margin-bottom:clamp(5px,.8dvh,8px);
}
.dm-duel-champ-head h3 {
  margin:0; display:flex; align-items:center; gap:7px;
  font-size:clamp(14px,4vw,16px); font-weight:1000; letter-spacing:-.01em;
}
.dm-duel-champ-icon {
  width:25px; height:25px; border-radius:8px;
  background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.2);
  display:grid; place-items:center; color:#ffd426;
}
.dm-duel-champ-icon .dm-duel-icon {width:14px; height:14px}
.dm-duel-champ-rank-pill {
  padding:2px 8px; border-radius:999px;
  background:rgba(76,227,232,.18); border:1px solid rgba(76,227,232,.35);
  color:#9cf4f7; font-size:10.5px; font-weight:900; white-space:nowrap;
}
.dm-duel-champ-list {
  display:grid; gap:1px; margin-bottom:clamp(6px,1dvh,9px);
  font-size:12.5px; color:rgba(255,255,255,.82);
}
.dm-duel-champ-empty {margin:4px 0; text-align:center; font-size:12.5px; color:rgba(255,255,255,.8)}
.dm-duel-champ-row {
  display:flex; align-items:center; gap:9px; padding:clamp(4px,.6dvh,6px) 2px;
  border-bottom:1px solid rgba(255,255,255,.11);
}
.dm-duel-champ-row:last-child {border-bottom:0}
.dm-duel-champ-row.is-first {padding:2px 2px clamp(6px,.9dvh,8px); border-bottom-color:rgba(255,255,255,.18)}
.dm-duel-champ-num {
  width:20px; text-align:center; flex:none;
  font-size:13px; font-weight:1000; color:rgba(255,255,255,.82);
}
.dm-duel-champ-row.is-first .dm-duel-champ-num {font-size:20px; color:#ffd426}
.dm-duel-champ-row:nth-child(3) .dm-duel-champ-num {color:#f5b971}
.dm-duel-champ-avatar {
  width:clamp(24px,3.4dvh,28px); height:clamp(24px,3.4dvh,28px); flex:none;
  border-radius:50%; overflow:hidden; display:grid; place-items:center;
  background:#e8f6ff; border:2px solid rgba(255,255,255,.35);
}
.dm-duel-champ-row.is-first .dm-duel-champ-avatar {
  width:clamp(36px,5.2dvh,44px); height:clamp(36px,5.2dvh,44px);
  border:2px solid #ffd426; box-shadow:0 3px 10px rgba(0,0,0,.22);
}
.dm-duel-champ-avatar svg {width:100%; height:100%; display:block}
.dm-duel-champ-info {flex:1; min-width:0; display:grid; gap:3px}
.dm-duel-champ-name {
  flex:1; min-width:0; display:flex; align-items:center; gap:5px;
}
.dm-duel-champ-name strong {
  font-size:13.5px; font-weight:900; color:#fff;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.dm-duel-champ-row.is-first .dm-duel-champ-name strong {font-size:15px; font-weight:1000}
.dm-duel-self-tag {
  padding:1px 5px; border-radius:5px; flex:none;
  background:#ffd426; color:#261152; font-size:9.5px; font-weight:1000;
}
.dm-duel-champ-meta {display:flex; align-items:center; gap:7px; flex-wrap:wrap}
.dm-duel-champ-meta small {font-size:11px; font-weight:800; color:rgba(255,255,255,.78)}
.dm-duel-xp-pill {
  padding:2.5px 9px; border-radius:999px; flex:none;
  background:#9aebf2; color:#053340; font-size:11.5px; font-weight:1000;
  white-space:nowrap;
}
.dm-duel-champ-more {
  width:100%; min-height:clamp(32px,4.4dvh,36px); padding:6px 12px; border:0; border-radius:12px;
  background:#b3f0f5; color:#053340;
  display:flex; align-items:center; justify-content:center; gap:4px;
  font-size:13px; font-weight:1000;
  transition:background .15s ease,transform .12s ease;
}
.dm-duel-champ-more:active {transform:translateY(1px); background:#96e5ec}
.dm-duel-champ-more .dm-duel-chevron {width:14px; height:14px}

@keyframes dm-duel-shine {0%,35%{left:-45%}72%,100%{left:125%}}
@keyframes dm-duel-arena-glow {0%,100%{opacity:.3}50%{opacity:.95}}
#dmDuelHome[hidden] :is(.dm-duel-arena,.dm-duel-quick)::after {animation-play-state:paused}

@media(max-height:640px) {
  .dm-duel-page-inner {gap:5px; padding:4px 12px 6px}
  #dmDuelHome .dm-duel-arena {padding:7px 10px; gap:5px}
  .dm-duel-papi-slot {width:52px}
  .dm-duel-options button {min-height:42px; padding:5px 8px}
  .dm-duel-champions {padding:8px 11px}
}
@media(max-width:350px) {
  .dm-duel-options {gap:7px}
  .dm-duel-options button {gap:7px; padding:8px; font-size:12px}
  .dm-duel-option-icon {width:34px}
}
@media(prefers-reduced-motion:reduce) {
  #dmDuelHome :is(.dm-duel-arena,.dm-duel-quick)::after {animation:none}
  #dmDuelHome .dm-duel-arena::after {opacity:.55}
}

/* Night Theme */
html[data-dm-theme=night] #dmDuelHome {background:#262044; color:#f2ebff}
html[data-dm-theme=night] #dmDuelHome .dm-duel-brand small {color:#412800}
html[data-dm-theme=night] .dm-duel-options button,
html[data-dm-theme=night] .dm-duel-stats-card {
  background:#342b5c; border-color:#4b3e82; border-bottom-color:#231c42; color:#f4eeff;
}
html[data-dm-theme=night] .dm-duel-stats-title {color:#c7b8eb}
html[data-dm-theme=night] .dm-duel-history {color:#d8c2ff}
html[data-dm-theme=night] .dm-duel-personal span {border-inline-end-color:#4b3e82}
html[data-dm-theme=night] .dm-duel-personal b {color:#fff}
html[data-dm-theme=night] .dm-duel-personal small {color:#cbbce8}

/* Takımım navigation is shared by the arena and both ranking views. */
.dm-arena-tabs {
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:minmax(0,1fr);
  gap:3px;
  padding:3px;
  border:2px solid #e5d7f4;
  border-radius:16px;
  background:#f0e6fa;
}
.dm-arena-tabs button {
  min-width:0;
  min-height:42px;
  padding:4px;
  background:transparent;
  color:#350947;
  border:0;
  border-radius:12px;
  font:900 clamp(11px,3.4vw,16px)/1.15 Nunito,system-ui,sans-serif;
  cursor:pointer;
}
.dm-arena-tabs button[aria-pressed="true"] {
  background:linear-gradient(110deg,#ffe75e,#ffc51c);
  box-shadow:inset 0 0 0 1px #f5b624;
}
.dm-arena-tabs button:focus-visible {
  outline:2px solid #6d25ad;
  outline-offset:-2px;
}
.dm-arena-visually-hidden {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}
/* Duel B: independent foreground pieces on a plain page. */
#dmDuelHome.dm-duel-page {
  --duel-ink: #29113d;
  --duel-muted: #62566b;
  --duel-surface: #fff;
  --duel-edge: #b59adf;
  --duel-purple: #6330ba;
  background: #fff;
  color: var(--duel-ink);
}
#dmDuelHome.dm-duel-page .dm-duel-page-inner {
  min-height: 0;
  height: 100%;
  justify-content: flex-start;
  gap: clamp(9px, 1.9dvh, 18px);
  padding: clamp(10px, 2.2dvh, 22px) 15px 11px;
  overflow: auto;
  overscroll-behavior: contain;
}
#dmDuelHome.dm-duel-page .dm-duel-arena {
  isolation: isolate;
  overflow: visible;
  padding: 0;
  gap: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
#dmDuelHome.dm-duel-page .dm-duel-arena::after,
#dmDuelHome.dm-duel-page .dm-duel-hero-stage::before { display: none; }

#dmDuelHome.dm-duel-page .dm-duel-hero-stage {
  display: grid;
  grid-template-columns: 55% 45%;
  align-items: center;
  min-height: 0;
  height: clamp(108px, min(63vw, 36dvh), 320px);
  padding: 0;
  gap: 0;
  background: none;
}

#dmDuelHome.dm-duel-page .dm-duel-hero-copy {
  z-index: 1;
  width: 100%;
  min-width: 0;
  padding: clamp(6px, 1.65dvh, 17px) 9px;
  border: 2px solid #f4b746;
  border-radius: 21px 24px 23px 23px;
  background: linear-gradient(145deg, #fff9e9, #ffe1a9);
  box-shadow: inset 0 0 0 1px #fff9d2, 0 4px 0 #bf751b, 0 6px 10px #a5622929;
  transform: rotate(-3deg);
  color: #29113d;
}
#dmDuelHome.dm-duel-page .dm-duel-live-pill {
  padding: 4px 7px;
  margin-bottom: clamp(4px, 1dvh, 8px);
  border-radius: 999px;
  background: #ffe78e;
  border: 1px solid #d99b31;
  box-shadow: 0 2px 0 #d18727;
  color: #302246;
  font-size: clamp(10px, 3vw, 14px);
  font-weight: 750;
  white-space: nowrap;
}
#dmDuelHome.dm-duel-page .dm-duel-live-dot { background: #248143; box-shadow: none; }
#dmDuelHome.dm-duel-page .dm-duel-hero-copy h2 {
  margin: 0;
  color: #29113d;
  font-size: clamp(16px, min(5.5vw, 4.5dvh), 31px);
  line-height: 1.13;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.025em;
}
#dmDuelHome.dm-duel-page .dm-duel-hero-papi {
  display: block;
  width: 127%;
  max-width: none;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: bottom right;
  justify-self: end;
  align-self: end;
}

#dmDuelHome.dm-duel-page .dm-duel-quick {
  width: 89%;
  min-height: clamp(44px, 7.5dvh, 65px);
  margin: -2px auto 5px;
  border: 2px solid #ffcc5d;
  border-radius: 999px;
  background: linear-gradient(#e74749, #cd2939);
  color: #fff;
  font-size: clamp(17px, 5.3vw, 28px);
  font-weight: 800;
  text-shadow: 0 1px 2px #861a2e;
  box-shadow: inset 0 1px 0 #ffb8a8, 0 4px 0 #a02736, 0 6px 9px #65193932;
}
#dmDuelHome.dm-duel-page .dm-duel-quick span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  position: relative;
  z-index: 2;
}
#dmDuelHome.dm-duel-page .dm-duel-quick::after {
  display: block;
  width: 26%;
  background: linear-gradient(105deg, transparent 22%, #ffebaa99 52%, transparent 76%);
  animation: dm-duel-shine 2.8s ease-in-out infinite;
}
#dmDuelHome.dm-duel-page .dm-duel-quick:focus-visible {
  outline: 3px solid var(--duel-purple);
  outline-offset: 3px;
}

#dmDuelHome.dm-duel-page .dm-duel-options { grid-template-columns: 1fr; gap: 11px; }
#dmDuelHome.dm-duel-page .dm-duel-options button,
#dmDuelHome.dm-duel-page .dm-duel-history {
  border: 1.5px solid var(--duel-edge);
  background: var(--duel-surface);
  box-shadow: 0 3px 0 #9e71d9, 0 5px 8px #7041a71c;
}
#dmDuelHome.dm-duel-page .dm-duel-options button {
  min-height: clamp(44px, 7.6dvh, 68px);
  padding: 6px 11px;
  border-radius: 17px;
  color: var(--duel-ink);
  font-size: clamp(14px, 4.15vw, 22px);
  font-weight: 750;
}
#dmDuelHome.dm-duel-page .dm-duel-options .dm-duel-chevron { margin-left: auto; color: var(--duel-purple); }

#dmDuelHome.dm-duel-page .dm-duel-stats-card {
  margin-top: clamp(0px, calc((100dvh - 570px) / 9), 25px);
  margin-bottom: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#dmDuelHome.dm-duel-page .dm-duel-stats-head { margin-bottom: 9px; }
#dmDuelHome.dm-duel-page .dm-duel-stats-title {
  font-size: clamp(14px, 4.15vw, 22px);
  color: var(--duel-ink);
  font-weight: 750;
}
#dmDuelHome.dm-duel-page .dm-duel-history {
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--duel-purple);
  white-space: nowrap;
  font-weight: 750;
}
#dmDuelHome.dm-duel-page .dm-duel-personal {
  align-items: start;
  color: var(--duel-muted);
}
#dmDuelHome.dm-duel-page .dm-duel-personal span { border: 0; }
#dmDuelHome.dm-duel-page .dm-duel-stat {
  gap: 4px;
  background: transparent;
}
#dmDuelHome.dm-duel-page .dm-duel-personal b {
  color: var(--duel-ink);
  font-size: clamp(21px, 6vw, 30px);
  font-weight: 800;
}
#dmDuelHome.dm-duel-page .dm-duel-personal small {
  color: var(--duel-muted);
  font-size: clamp(11px, 3vw, 15px);
  font-weight: 700;
}
#dmDuelHome.dm-duel-page .dm-duel-stat-icon {
  width: clamp(35px, 11vw, 53px);
  height: clamp(34px, 10vw, 49px);
  padding: 0;
  background: var(--stat-image) center / contain no-repeat;
}
.dm-duel-stat-win { --stat-image: url("friends-assets/duel-b-win.webp"); }
.dm-duel-stat-loss { --stat-image: url("friends-assets/duel-b-loss.webp"); }
.dm-duel-stat-xp { --stat-image: url("friends-assets/duel-b-xp.webp"); }

html[data-dm-theme="night"] #dmDuelHome.dm-duel-page {
  --duel-ink: #fff4ff;
  --duel-muted: #d4c5df;
  --duel-surface: #392d49;
  --duel-edge: #9b83b6;
  --duel-purple: #dfc4ff;
  background: #252036;
}

@media (prefers-reduced-motion: reduce) {
  #dmDuelHome.dm-duel-page .dm-duel-quick::after { display: none; }
}

@media (max-height: 600px) {
  #dmDuelHome.dm-duel-page .dm-duel-hero-stage {
    height: clamp(100px, 29dvh, 172px);
  }
  #dmDuelHome.dm-duel-page .dm-duel-option-icon { width: 30px; }
  #dmDuelHome.dm-duel-page .dm-duel-stats-head { margin-bottom: 5px; }
  #dmDuelHome.dm-duel-page .dm-duel-stat-icon { height: 30px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #dmDuelHome.dm-duel-page .dm-duel-page-inner {
    width: min(100%, 850px);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 20px;
    row-gap: 6px;
    padding-block: 6px;
    align-content: center;
  }
  #dmDuelHome.dm-duel-page .dm-duel-arena { grid-row: 1 / 3; align-self: center; }
  #dmDuelHome.dm-duel-page .dm-duel-stats-card { margin-top: 0; align-self: start; }
  #dmDuelHome.dm-duel-page .dm-duel-options { gap: 7px; }
}

@media (orientation: portrait) and (max-height: 520px) {
  #dmDuelHome.dm-duel-page .dm-duel-page-inner { gap: 8px; padding-block: 8px; }
  #dmDuelHome.dm-duel-page .dm-duel-hero-stage { height: clamp(100px, 25dvh, 124px); }
  #dmDuelHome.dm-duel-page .dm-duel-options { gap: 8px; }
  #dmDuelHome.dm-duel-page .dm-duel-personal { gap: 2px; }
}

#dmDuelHome .dm-duel-wallet-host:empty { display: none; }
#dmDuelHome .dm-duel-wallet-host { flex: 0 0 auto; }
#dmDuelHome.dm-duel-page .dm-duel-page-inner { padding-top: 0; }
@media (orientation: landscape) and (max-height: 520px) {
  #dmDuelHome.dm-duel-page .dm-duel-page-inner { grid-template-rows: auto auto 1fr; }
  #dmDuelHome .dm-duel-wallet-host { grid-area: 1 / 1 / 2 / -1; }
  #dmDuelHome.dm-duel-page .dm-duel-arena { grid-area: 2 / 1 / 4 / 2; }
  #dmDuelHome .dm-duel-options { grid-area: 2 / 2; }
  #dmDuelHome .dm-duel-stats-card { grid-area: 3 / 2; }
}

@media (max-height: 600px) {
  #dmDuelHome.dm-duel-page .dm-duel-page-inner { gap: 6px; padding-bottom: 5px; }
}
@media (orientation: portrait) and (min-height: 601px) and (max-height: 760px) {
  #dmDuelHome.dm-duel-page .dm-duel-hero-stage { height: clamp(132px, min(44vw, 24dvh), 196px); }
  #dmDuelHome.dm-duel-page .dm-duel-stats-card { margin-top: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #dmDuelHome.dm-duel-page .dm-duel-page-inner { align-content: start; }
  #dmDuelHome.dm-duel-page .dm-duel-options button { min-height: 44px; font-size: 14px; }
  #dmDuelHome.dm-duel-page .dm-duel-stats-title { font-size: 14px; }
  #dmDuelHome.dm-duel-page .dm-duel-personal b { font-size: 21px; }
  #dmDuelHome.dm-duel-page .dm-duel-personal small { font-size: 11px; }
}

/* Remove excess gap below top wallet and fit Duel B in one viewport with no scroll. */
#dmDuelHome.dm-duel-page .dm-duel-page-inner {
  gap: clamp(5px, 1.05dvh, 11px);
  padding: 0 15px clamp(18px, 3dvh, 28px);
  justify-content: space-between;
}
#dmDuelHome.dm-duel-page .dm-duel-wallet-host { margin-bottom: 0; }
#dmDuelHome.dm-duel-page .dm-duel-arena { margin-top: -2px; }
#dmDuelHome.dm-duel-page .dm-duel-hero-stage {
  height: clamp(104px, min(46vw, 25dvh), 215px);
}
#dmDuelHome.dm-duel-page .dm-duel-hero-papi {
  object-position: center right;
}
#dmDuelHome.dm-duel-page .dm-duel-quick {
  width: 100%;
  min-height: clamp(54px, 7.6dvh, 66px);
  margin: 0 auto 2px;
  border-width: 2.5px;
  font-size: clamp(20px, 5.8vw, 26px);
  box-shadow: inset 0 2px 0 rgba(255,210,190,.7), 0 5px 0 #941729, 0 10px 22px rgba(200,33,55,.32);
}
#dmDuelHome.dm-duel-page .dm-duel-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
#dmDuelHome.dm-duel-page .dm-duel-options button {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(6px, 1.1dvh, 10px);
  min-height: clamp(124px, 19.5dvh, 160px);
  padding: 12px 8px 10px;
  border: 2px solid var(--duel-edge);
  border-radius: 22px;
  box-shadow: 0 4px 0 #9e74da, 0 8px 18px rgba(102,56,168,.10);
}
#dmDuelHome.dm-duel-page .dm-duel-option-icon {
  width: clamp(52px, 13.5vw, 68px);
  height: clamp(52px, 13.5vw, 68px);
  border-radius: 19px;
  border-bottom-width: 4px;
  box-shadow: 0 6px 14px rgba(0,0,0,.14);
}
#dmDuelHome.dm-duel-page .dm-duel-option-icon .dm-duel-icon { width: 64%; height: 64%; }
#dmDuelHome.dm-duel-page .dm-duel-option-copy {
  display: grid;
  gap: 2px;
  justify-items: center;
}
#dmDuelHome.dm-duel-page .dm-duel-option-copy b {
  font-size: clamp(13.5px, 3.8vw, 16px);
  font-weight: 900;
  line-height: 1.15;
  color: var(--duel-ink);
}
#dmDuelHome.dm-duel-page .dm-duel-option-copy small {
  font-size: clamp(10.5px, 2.8vw, 12px);
  font-weight: 700;
  color: var(--duel-muted);
}
#dmDuelHome.dm-duel-page .dm-duel-stats-card {
  margin-top: 0;
  margin-bottom: 0;
}
#dmDuelHome.dm-duel-page .dm-duel-stats-head { margin-bottom: 5px; }
#dmDuelHome.dm-duel-page .dm-duel-stat-icon {
  width: clamp(30px, 8.5vw, 44px);
  height: clamp(28px, 8vw, 42px);
}
@media (max-height: 620px) {
  #dmDuelHome.dm-duel-page .dm-duel-options button { min-height: 108px; padding: 8px 6px; }
  #dmDuelHome.dm-duel-page .dm-duel-option-icon { width: 46px; height: 46px; border-radius: 15px; }
}
