button { min-width: 44px; min-height: 44px; color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button:disabled { cursor: default; }
b { color: var(--red); }
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 750; letter-spacing: .13em; }
.primary { min-height: 50px; min-width: 176px; border: 0; font-weight: 850; background: var(--red); color: #101820; padding: 10px 18px; text-align: left; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%); }
.primary span { float: right; margin-inline-start: 20px; }
.primary:disabled { opacity: .55; }
.echo { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: .82rem; }
.echo p { margin: 0; padding: 6px 8px; border-left: 2px solid var(--teal); background: #1e2f3c; }
#echo-face, #result-echo-face { flex: 0 0 44px; height: 44px; background-image: url('../../assets/sprites/echo-portraits.png'); background-size: 200% 200%; }
[aria-pressed="true"] { border-color: var(--teal); }
#backup-dialog { width: min(480px, calc(100% - 32px)); color: var(--paper); background: var(--ink); border: 1px solid var(--teal); }
#backup-dialog::backdrop { background: #000b; }
#backup-dialog label { display: grid; margin-block: 12px; gap: 8px; }
#backup-file { max-width: 100%; }
body,button,input,select,textarea { font-family:var(--m6-font); -webkit-font-smoothing:antialiased; }
body {
  isolation: isolate;
  background: radial-gradient(#ffffff0a 1px, transparent 1px) 0 0/12px 12px, #0f1014;
  color: #f5f6f8;
}
body::before {
  content: attr(data-watermark);
  position: fixed;
  z-index: -1;
  inset: 15% 0 auto;
  overflow: hidden;
  pointer-events: none;
  text-align: center;
  font: italic 900 26vw/1 Impact, sans-serif;
  color: #ffffff06;
  transform: skewY(-10deg);
}
.panel { background:rgba(21,22,28,.86); border:2px solid #30323c; backdrop-filter:blur(10px); border-radius:14px; }
.m6-lime { background:var(--m6-lime); color:#101014; border:3px solid #080809; border-radius:999px; font-weight:900; }
.lobby-open main, main, .masthead, .settings { width:min(100%,1500px); max-width:1500px; margin-inline:auto; }
.masthead, .lobby-open .masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:rgba(15,16,21,.84);
  backdrop-filter:blur(14px);
  border-bottom:2px solid #2e303a;
  padding:10px 16px;
  gap:8px 12px;
  min-height:66px;
}
.masthead .brand { display:flex; align-items:center; gap:10px; font-family:var(--m6-display); font-weight:900; letter-spacing:.06em; font-size:1.05rem; }
.masthead .brand i { background:linear-gradient(135deg,var(--m6-lime) 0 48%,var(--m6-orange) 48% 100%); width:16px; height:24px; }
.masthead .brand small { display:block; font-family:var(--m6-display); font-size:10px; letter-spacing:.14em; color:#9fa4b4; }
.masthead button {
  background:#22242c;
  color:#f2f4f8;
  border:2px solid #383b47;
  border-radius:999px;
  padding:6px 14px;
  font-weight:800;
  font-size:.88rem;
  letter-spacing:.02em;
  transition:transform .12s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.masthead button:hover { border-color:var(--m6-lime); background:#2c2f3a; }
.masthead button:active { transform:scale(.95); }
#hub-nav { gap:6px; }
#hub-nav button {
  border-radius:8px;
  transform:skewX(-10deg);
  padding:7px 14px;
  background:#1b1d24;
  border:2px solid #353844;
  color:#d6dae4;
}
#hub-nav button span { display:inline-block; transform:skewX(10deg); }
#hub-nav button[aria-current="page"] {
  background:var(--m6-lime);
  border-color:#0b0c10;
  color:#111216;
  font-weight:900;
  box-shadow:0 0 14px rgba(200,255,0,.3);
}
.header-actions { gap:6px; }
#m6-back { display:inline-flex; align-items:center; gap:5px; padding:6px 14px; border-radius:999px; background:#1b1c22; color:#ff6a33; border:2px solid var(--m6-orange); font-weight:900; white-space:nowrap; box-shadow:0 0 0 1px #090a0d inset; }
#m6-back:hover { background:var(--m6-orange); border-color:var(--m6-orange); color:#111116; }
#m6-back[hidden] { display:none; }
#m6-avatar { width:38px; height:38px; background:var(--m6-lime); border:2px solid #0b0c10; border-radius:50%; overflow:hidden; flex:none; box-shadow:0 0 10px rgba(200,255,0,.25); }
#m6-avatar img { width:145px; max-width:none; position:relative; left:-54px; top:-4px; }
#m6-level,#balance,#book-capsule {
  padding:6px 13px;
  white-space:nowrap;
  border-radius:999px;
  background:#1f2129;
  border:2px solid #353844;
  font-weight:900;
  font-variant-numeric:tabular-nums;
  font-size:.88rem;
}
#balance { color:#ffd84d; border-color:#4b4324; }
#balance::after { content:' +'; color:var(--m6-lime); font-weight:900; }
#book-capsule { color:#eef1f7; }
#book-capsule:hover { border-color:var(--m6-lime); }
.m6-transition { position:fixed; z-index:10000; inset:-2vh -22vw; background:linear-gradient(90deg,var(--m6-lime) 0 25%,#0f1014 25% 88%,transparent 88%),repeating-linear-gradient(135deg,var(--m6-orange) 0 11px,#161616 11px 23px); }
.m6-transition[data-theme=pink] { background:linear-gradient(90deg,#e12b87 0 25%,#0f1014 25% 88%,var(--m6-orange) 88%); }
.m6-transition.quiet { background:#15151a; }
.m6-confirm { background:#202026; border:2px solid #71737c; padding:0; border-radius:18px; width:min(92vw,420px); }
.m6-confirm header { display:flex; align-items:center; justify-content:space-between; padding:8px 12px; font-weight:900; background:repeating-linear-gradient(135deg,#3a3b42 0 12px,#2b2b32 12px 24px); }
.m6-confirm header button { background:var(--m6-orange); }
.m6-confirm img { display:block; width:90px; margin:12px auto; }
.m6-confirm p { text-align:center; margin:16px; }
.m6-confirm footer { display:flex; justify-content:center; gap:10px; padding:10px; }
.m6-confirm footer button { border-radius:999px; min-width:105px; }
.m6-confirm footer button:first-child { border-color:var(--m6-orange); }
.m6-confirm footer button:last-child { background:var(--m6-lime); color:#151515; }
@media(max-width:700px) and (orientation:portrait) {  #m6-avatar,#m6-level { display:none; }}
.settings { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 14px; margin-block-end: 12px; }
.settings label { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.settings input { accent-color: var(--teal); }
.settings small { color: var(--muted); }
.masthead { flex-wrap: wrap; }
#hub-nav, .header-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.header-actions strong { color: var(--gold); white-space: nowrap; }
@media (orientation: portrait) and (max-width: 700px) {
  body:has(#hub-nav:not([hidden])) { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  #hub-nav { position: fixed; z-index: 4; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #0f1923; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .lobby-open .masthead { z-index: auto; }
  .masthead, .lobby-open .masthead { backdrop-filter: none; }
  #hub-nav button { padding: 0 2px; }
  #hub-nav span { display: block; }
  .header-actions { justify-content: flex-start; }
  .header-actions button { padding-inline: 7px; }
}
@media (orientation: landscape) and (max-height: 540px) { .masthead { min-height: 50px; } }
button { background: var(--button); border: 2px solid var(--line); border-radius: 999px; }
button:not(:disabled):active { scale: .95; }
select { appearance: none; background: var(--button); border: 2px solid var(--line); border-radius: 999px; min-height: 44px; padding: 4px 14px; color: var(--paper); cursor: pointer; }
.ui-cut { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%); }
.ui-segments { display: flex; gap: 6px; flex-wrap: wrap; }
.ui-segments [aria-pressed=true] { background: var(--m6-lime); color: var(--lime-text); }
.ui-dot-grid { background-image: radial-gradient(#ffffff19 1px, transparent 1px); background-size: 12px 12px; }
.ui-caution { color: var(--ink); background: repeating-linear-gradient(135deg, var(--gold) 0 20px, var(--ink) 20px 23px); }
.ui-tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; }
game-bar { display: inline-block; position: relative; min-height: 5px; height: 8px; min-width: 1px; background: var(--button); overflow: hidden; transform: skewX(-10deg); }
game-bar::before, game-bar::after { position: absolute; content: ''; inset: 0 auto 0 0; }
game-bar::before { width: var(--bar-fill); background: var(--bar-color); z-index: 1; }
game-bar[trail]::after { width: var(--bar-trail); background: white; opacity: .75; transition: width 180ms 110ms ease-out; }
game-bar[segments]::after { z-index: 2; }
body:has(#reduced-flash:checked) game-bar[trail]::after { transition: none; }
.mission-select, .abilities { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 8px; }
.mission-select label { display: grid; gap: 4px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body:not(:has(#reduced-flash:checked)) button:not(:disabled):hover { translate: 0 -2px; }
}
game-bar[segments]::after { width: 100%; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--bar-segment) - 2px), var(--ink) calc(var(--bar-segment) - 2px) var(--bar-segment)); }
@media (prefers-reduced-motion: reduce) { game-bar[trail]::after { transition: none; } button:not(:disabled):active { scale: 1; } }

body[data-screen="title"] > .masthead { display: none; }
.masthead #book-capsule { display: none; }
.masthead .header-actions { margin-left: auto; }
#brand-home { background: transparent; border: 0; border-radius: 8px; padding: 4px 8px; }
#brand-home:hover { background: rgba(255,255,255,.06); border: 0; }
#player-card, .header-actions button, #book-capsule { background: #1e2028; border: 2px solid #353844; border-radius: 999px; padding: 5px 13px; min-height: 44px; }
#player-card { display: inline-flex; align-items: center; gap: 10px; text-align: left; min-width: 0; padding: 4px 14px 4px 5px; height: 46px; min-height: 46px; }
#player-card #m6-avatar { width: 34px; height: 34px; }
#player-card > span:last-child { min-width: 96px; display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 8px; row-gap: 4px; line-height: 1; }
#player-name { display: block; max-width: 10ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 800; color: #f5f6f8; }
#player-card #m6-level { padding: 0; border: 0; background: transparent; border-radius: 0; font-size: .78rem; font-weight: 900; color: var(--m6-lime); }
#player-card game-bar { grid-column: 1 / -1; display: block; width: 100%; height: 3px; margin: 0; }
.m6-confirm .dialog-body { padding: 14px 18px; }
#m6-avatar canvas { width: 100%; height: 100%; object-fit: cover; }
body dialog.ui-dialog { width: min(700px, calc(100% - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0 14px 14px; border-radius: 14px; border: 2px solid #353844; background: #15161c; color: #f5f6f8; overflow: auto; }
body dialog.ui-dialog:not([open]) { display: none; }
.ui-dialog::backdrop { background: #08090cdb; }
.ui-dialog > header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 12px; margin: 0 -14px 12px; background: repeating-linear-gradient(135deg,#292c35 0 8px,#22242c 8px 16px); }
.ui-dialog button, .identity-avatars button { border: 2px solid #353844; border-radius: 999px; color: inherit; background: #23262e; padding: 4px 12px; }
.ui-dialog > header button { background: #ff4d00; color: #111216; }
.ui-dialog [aria-pressed="true"], .identity-avatars [aria-pressed="true"] { border-color: #c8ff00; }
.ui-dialog > form[method="dialog"] { margin-top: 12px; display: flex; justify-content: flex-end; }
.ui-dialog > form[method="dialog"] button, #accept-duel button:last-child { background: #c8ff00; color: #111216; font-weight: 850; }
#settings input[type="range"] { appearance: none; height: 24px; background: transparent; }
#settings input[type="range"]::-webkit-slider-runnable-track { background: #353844; border-radius: 999px; height: 8px; }
#settings input[type="range"]::-webkit-slider-thumb { appearance: none; background: #c8ff00; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; }
.identity-avatars { display: flex; gap: 8px; flex-wrap: wrap; margin-block: 12px; }
.identity-avatars :is(img, canvas) { width: 42px; height: 48px; display: block; object-fit: contain; }
@media (max-width: 700px) and (orientation: portrait) {
  body .masthead { position: relative; flex-wrap: wrap; padding: 4px 8px; gap: 4px; }
  #brand-home small { display: none; }
  #brand-home, #player-card, .header-actions button, #book-capsule { padding-inline: 7px; }
  .header-actions { flex-wrap: wrap; gap: 4px; }
}
