/* Duels: invitation page, lobby, result panel, profile sheet. Uses the Maruko tokens from style.css (so night mode follows). */

.duel-hint { margin: 0 0 18px; }

/* ---- invitation ---- */
#view-duel { padding-block: 24px; }
.dl-invite { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 26px 20px; }
.dl-invite h2 { margin: 0; font: 800 clamp(1.6rem, 6vw, 2.2rem)/1.2 var(--display); text-wrap: balance; }
.dl-invite form { display: grid; gap: 10px; width: min(420px, 100%); text-align: start; }
.dl-invite label { font-weight: 800; color: var(--ink-2); }
.dl-invite input { width: 100%; min-height: 56px; padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 2.5px solid var(--line); color: var(--ink); font: 700 1.25rem var(--display); outline: none; }
.dl-invite input:focus { box-shadow: 0 0 0 4px var(--focus-glow); }
.dl-big { font-size: 3.2rem; line-height: 1; animation: rise .4s cubic-bezier(.2, 1.3, .4, 1) both; }
.dl-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dl-pill { padding: 4px 12px; border-radius: 999px; background: var(--note-blue); border: 2px solid var(--line); font-weight: 800; }
.dl-pill small { color: var(--ink-2); }
.dl-note { display: grid; gap: 6px; justify-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--note); border: 2px dashed var(--line-soft); font-weight: 700; max-width: 420px; }
.dl-note p { margin: 0; }
.dl-note.ok { background: var(--ok-bg); border-style: solid; }

/* ---- lobby ---- */
.dl-lobby { display: grid; gap: 14px; max-width: 640px; margin-inline: auto; }
.dl-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; }
.dl-head h3 { margin: 0; font: 800 1.3rem var(--display); }
.dl-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.dl-vs { align-self: center; font: 800 1rem var(--display); color: var(--ink-3); }
.dl-side { padding: 12px; border-radius: var(--wob); border: 2.5px solid var(--line); background: color-mix(in srgb, var(--tc) 22%, var(--card)); box-shadow: var(--pop); display: grid; gap: 8px; align-content: start; min-width: 0; }
.dl-side-head { display: flex; align-items: center; gap: 8px; }
.dl-side-head .mon { width: 40px; height: 40px; flex: none; }
.dl-side-head b { font: 800 1.02rem var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.dl-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dl-p { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line-faint); min-width: 0; }
.dl-p.me { border-color: var(--line); }
.dl-p.off { opacity: .55; }
.dl-pn { display: grid; min-width: 0; line-height: 1.2; flex: 1; }
.dl-pn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-pn em { color: var(--ink-3); font-style: normal; font-weight: 700; font-size: .85em; }
.dl-ti { color: var(--red-text); font-weight: 800; }
.dl-lv, .dl-guest { padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--line-soft); font-weight: 800; white-space: nowrap; background: var(--note); }
.dl-guest { background: var(--surface-3); color: var(--ink-2); }
.dl-empty { padding: 14px 8px; text-align: center; color: var(--ink-3); font-weight: 700; border: 2px dashed var(--line-soft); border-radius: 12px; }
.dl-av { --fr: transparent; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 800 1.05rem var(--display); background: var(--sun); color: var(--on-pastel); border: 2.5px solid var(--line); box-shadow: 0 0 0 3px var(--fr); overflow: hidden; }
.dl-av img { width: 100%; height: 100%; object-fit: cover; }
.dl-av.big { width: 64px; height: 64px; font-size: 1.7rem; box-shadow: 0 0 0 4px var(--fr); }
.dl-invites { display: grid; gap: 16px; padding: 16px; }
.dl-link { display: grid; gap: 8px; }
.dl-link h4 { margin: 0; font: 800 1.02rem var(--display); }
.dl-link input { width: 100%; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line-soft); background: var(--surface); color: var(--ink-2); font: 600 .95rem ui-monospace, Menlo, monospace; text-align: start; }
.dl-link-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-link-btns .btn { text-decoration: none; }
.dl-actions { display: grid; gap: 10px; justify-items: center; }
.dl-actions .btn-xl { width: 100%; }
.dl-wait { padding: 14px; font-weight: 800; color: var(--ink-2); text-align: center; }
.dl-sub { font-size: .9rem; }
@media (max-width: 460px) { .dl-sides { grid-template-columns: 1fr; } .dl-vs { justify-self: center; } }

/* ---- result ---- */
.dl-result { display: grid; gap: 12px; justify-items: center; text-align: center; }
.dl-result .winner-mon { width: 110px; height: 110px; }
.dl-score { font: 800 2.4rem/1 var(--display); letter-spacing: .04em; }
.dl-reward { display: grid; gap: 8px; justify-items: center; width: 100%; padding: 12px; border-radius: var(--r); background: var(--note); border: 2px dashed var(--line-soft); }
.dl-xp { font: 800 1.35rem var(--display); color: var(--green-text); }
.dl-lvup { font: 800 1.15rem var(--display); color: var(--red-text); animation: pulse 1.4s ease-in-out infinite; }
.dl-rb h4 { margin: 0 0 4px; font-size: .9rem; color: var(--ink-2); }
.dl-badge { display: inline-block; margin: 2px; padding: 4px 12px; border-radius: 999px; background: var(--sun); color: var(--on-pastel); border: 2px solid var(--line); font-weight: 800; }
.dl-credit { padding: 6px 14px; border-radius: 999px; background: var(--ok-bg); border: 2px solid var(--line); font-weight: 800; }
.dl-rivalry { font-weight: 800; color: var(--ink-2); }
.dl-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.dl-board li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line-faint); text-align: start; }
.dl-board li.won { background: var(--best-bg); }
.dl-board li.me { border-color: var(--line); }
.dl-board b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-sc { color: var(--ink-2); font-weight: 700; font-size: .88rem; }
.dl-res-actions { display: grid; gap: 10px; width: 100%; }
.dl-res-actions .btn { width: 100%; text-decoration: none; }

/* ---- profile sheet ---- */
#dl-sheet { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 12px; background: var(--overlay); }
.dl-card { width: min(600px, 100%); max-height: min(92vh, 940px); overflow: auto; padding: 20px; border-radius: var(--wob-lg); background: var(--card); border: 2.5px solid var(--line); box-shadow: var(--pop); display: grid; gap: 12px; animation: rise .35s cubic-bezier(.2, 1.3, .4, 1) both; }
.dl-card h4 { margin: 8px 0 0; font: 800 1.08rem var(--display); }
.dl-card h4 small { color: var(--ink-3); }
.dl-card-head { display: flex; justify-content: space-between; align-items: center; }
.dl-card-head h3 { margin: 0; font: 800 1.35rem var(--display); }
.dl-me { display: flex; align-items: center; gap: 12px; }
.dl-me > div:nth-child(2) { flex: 1; min-width: 0; }
.dl-name { font: 800 1.25rem var(--display); }
.dl-title { color: var(--red-text); font-weight: 800; }
.dl-lvl { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--sun); border: 2.5px solid var(--line); font-weight: 800; font-size: .72rem; line-height: 1; box-shadow: var(--pop); color: var(--on-pastel); }
.dl-lvl b { font: 800 1.6rem/1 var(--display); }
.dl-xpbar { position: relative; height: 24px; border-radius: 999px; background: var(--track); border: 2px solid var(--line); overflow: hidden; }
.dl-xpbar i { position: absolute; inset: 0 auto 0 0; background: var(--leaf); }
html[dir="rtl"] .dl-xpbar i { inset: 0 0 0 auto; }
.dl-xpbar span { position: relative; display: block; text-align: center; font-weight: 800; font-size: .82rem; line-height: 20px; color: var(--ink); }
.dl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dl-stat { display: grid; place-items: center; padding: 8px 4px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line-faint); }
.dl-stat b { font: 800 1.35rem/1.1 var(--display); }
.dl-stat span { font-size: .78rem; color: var(--ink-2); font-weight: 700; }
.dl-best { margin: 0; font-weight: 700; }
.dl-ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.dl-a { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 14px; background: var(--surface-3); border: 2px solid var(--line-faint); opacity: .62; }
.dl-a.on { opacity: 1; background: var(--best-bg); border-color: var(--line); }
.dl-ai { font-size: 1.7rem; line-height: 1; filter: grayscale(1); }
.dl-a.on .dl-ai { filter: none; }
.dl-a > div { display: grid; gap: 2px; min-width: 0; }
.dl-a small { color: var(--ink-2); font-weight: 600; line-height: 1.35; }
.dl-when { color: var(--green-text) !important; font-weight: 800 !important; }
.dl-rew { letter-spacing: .15em; }
.dl-prog { display: block; height: 7px; border-radius: 99px; background: var(--track); border: 1.5px solid var(--line-soft); overflow: hidden; }
.dl-prog s { display: block; height: 100%; background: var(--sky); }
html[dir="rtl"] .dl-prog s { margin-inline-start: auto; }
.dl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-chip { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line-soft); color: var(--ink); font: 800 .95rem var(--body); cursor: pointer; }
.dl-chip.on { background: var(--sun); border-color: var(--line); color: var(--on-pastel); }
.dl-fr { display: inline-flex; align-items: center; gap: 4px; }
.dl-fr i { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.dl-rivals, .dl-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dl-rivals li, .dl-hist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line-faint); }
.dl-rivals .good { color: var(--green-text); font-weight: 800; } .dl-rivals .bad { color: var(--red-text); font-weight: 800; }
.dl-hist li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-hist li small { color: var(--ink-3); white-space: nowrap; }
.dl-hist li.w span { color: var(--green-text); font-weight: 800; } .dl-hist li.l span { color: var(--red-text); font-weight: 800; }
.dl-cap { font-size: .85rem; text-align: center; margin: 4px 0 0; }

/* signed-in landing nav on phones: let the tools wrap instead of widening the whole page */
@media (max-width: 640px) {
  #topnav { flex-wrap: wrap; row-gap: 6px; }
  .nav-tools { flex: 1 1 0; min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .nav-tools .pill-btn { white-space: nowrap; }
  #home-user { min-width: 0; max-width: 100%; }
  .userchip2 .uname { max-width: 7ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
