:root {
  --bg: #12062e;
  --surface: #241058;
  --surface-2: #33187a;
  --line: #5a35b5;
  --text: #ffffff;
  --muted: #c9bdf0;
  --pink: #ff5fd8;
  --violet: #8b3dff;
  --gold: #fee440;
  --danger: #f75d5d;
  --info: #4fd1c5;
  --clout: #ff8a3d;
  --aura: #46c8ff;
  --accent: var(--pink);
  --glow: 0 0 16px rgba(170, 80, 255, .55);
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Khmer", sans-serif;
  --scale: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--scale)); }
body {
  margin: 0;
  background: linear-gradient(rgba(18, 6, 46, .3), rgba(18, 6, 46, .8)), url("/art/backdrops/city.svg") center bottom / cover no-repeat fixed var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body.dyslexia { font-family: Verdana, Tahoma, var(--font); letter-spacing: .04em; word-spacing: .12em; line-height: 1.7; }
body.reduced-motion *, body.reduced-motion *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition-duration: 0s !important; } }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
body.no-nav #app { padding-bottom: 28px; }
body.no-nav #nav { display: none; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; }
h3 { font-size: 1rem; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.brand { font-weight: 800; letter-spacing: .14em; font-size: .75rem; color: var(--pink); text-transform: uppercase; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
a.card { text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.card.hero { border-color: var(--accent); background: linear-gradient(160deg, var(--surface-2), var(--surface)); }

button, .btn {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: 48px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  width: 100%;
  transition: transform .08s ease, border-color .12s ease;
}
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--pink); border-color: var(--pink); color: #1c0612; }
.ghost { background: transparent; }
.linkish { background: none; border: 0; min-height: 36px; padding: 6px; color: var(--muted); font-weight: 500; text-decoration: underline; width: auto; }
.danger { color: #ff9db0; border-color: #6d2a3a; }
.option { text-align: left; font-weight: 600; padding: 16px; }
.option:hover { border-color: var(--pink); }
.option.selected { border-color: var(--pink); background: #3b1c3c; }
:focus-visible { outline: 3px solid var(--aura); outline-offset: 2px; }

input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  width: 100%;
}
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.setting select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.setting input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--pink); }
.error { color: #ff9db0; font-size: .9rem; }

/* Progress and timers */
.progress { display: flex; gap: 6px; }
.progress span { flex: 1; height: 5px; background: var(--surface-2); border-radius: 3px; }
.progress span.done { background: var(--pink); }
.timer { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.timer div { height: 100%; width: 100%; background: var(--clout); transform-origin: left; }

/* Stats. Icons and labels carry the meaning, so nothing relies on color alone. */
.stat { display: grid; grid-template-columns: 76px 1fr 30px; gap: 8px; align-items: center; font-weight: 700; font-size: .9rem; }
.stat .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.stat .fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.stat.clout .fill { background: var(--clout); }
.stat.aura .fill { background: var(--aura); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: .85rem; font-weight: 700; }
.pop { animation: pop .28s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Story */
.scene { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; cursor: pointer; min-height: 45dvh; width: 100%; background: none; border: 0; padding: 0; font-weight: 400; text-align: left; }
.scene:active { transform: none; }
.speaker { color: var(--accent); font-weight: 800; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; }
.speaker-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.portrait { width: 4.5rem; height: 4.5rem; flex: none; border-radius: 18px; }
.line { font-size: 1.3rem; line-height: 1.4; }
.tap-hint { color: var(--muted); font-size: .85rem; }

/* Persona card */
.persona {
  border: 2px solid var(--accent);
  border-radius: 24px;
  padding: 24px 20px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--accent) 24%, var(--surface)), var(--surface) 65%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.persona h1 { color: var(--accent); font-size: 2.3rem; }
.emblem { display: block; flex: none; width: 6rem; height: 6rem; }
.masked { filter: blur(7px); user-select: none; }

.score { font-size: 4.5rem; font-weight: 900; line-height: 1; color: var(--pink); letter-spacing: -.03em; }
.compare { display: grid; grid-template-columns: 1fr 26px; gap: 4px 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.tick { font-weight: 900; text-align: right; }

/* Receipt */
.receipt { border: 1px dashed var(--muted); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.receipt .final { font-size: 1.5rem; font-weight: 900; color: var(--pink); text-transform: uppercase; }
.member { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; }
.member .linkish { font-size: .85rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface); font-weight: 700; font-size: .9rem; }
.tile.locked { color: var(--muted); border-style: dashed; font-weight: 500; display: flex; align-items: center; justify-content: center; min-height: 7.75rem; }
.tile.owned { border-color: var(--accent); color: var(--accent); }
.tile .emblem { width: 3.25rem; height: 3.25rem; margin-bottom: 8px; }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  background: rgba(11, 10, 20, .94);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#nav a { flex: 1; min-width: 0; max-width: 80px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; text-decoration: none; color: var(--muted); font-size: .62rem; font-weight: 700; }
#nav a[aria-current="page"] { color: var(--pink); }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-weight: 700;
  padding: 10px 16px; border-radius: 999px; max-width: 90vw; width: max-content;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
#toast.show { opacity: 1; }

.mini { width: auto; flex: 1; min-height: 44px; padding: 8px 14px; }
.mini.wide { flex: none; min-width: 84px; }
.member.card { flex-direction: row; }
select.report { font: inherit; font-size: .85rem; color: var(--muted); background: transparent; border: 0; text-decoration: underline; padding: 6px; max-width: 84px; }
select.report option { color: var(--text); background: var(--surface); }
.orbit { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 14px; font-size: .95rem; }
.hidden-route { border-color: var(--aura); }
.hidden-route::before { content: '🔓 '; }
.stat-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.stat-fill { height: 100%; background: var(--pink); border-radius: 4px; transition: width .5s ease; }
button.tile { font-weight: 700; min-height: 48px; }

.flicker { animation: flicker 2.8s steps(1) infinite; }
@keyframes flicker { 0%, 91%, 95%, 100% { opacity: 1; } 92%, 94% { opacity: .55; } 93% { opacity: .85; } }

.bubble { align-self: flex-start; background: var(--surface-2); border-radius: 14px; padding: 8px 12px; max-width: 85%; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: #3b1c3c; }
.chat-list { max-height: 320px; overflow-y: auto; }
form.row input { flex: 1; min-width: 0; }

/* Avatar: every layer has the same canvas, so stacking them lines up exactly. */
.avatar { position: relative; flex: none; width: min(60%, 210px); aspect-ratio: 3 / 4; margin: 0 auto; }
.avatar::before { content: ''; position: absolute; left: 12%; right: 12%; bottom: 0; height: 7%; border-radius: 50%; background: color-mix(in srgb, var(--accent) 28%, transparent); }
.avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.closet-group { display: flex; flex-direction: column; gap: 10px; }

/* Duo frame: only drawn when both friends wear the same one. */
.persona.duo-frame { outline: 2px solid var(--accent); outline-offset: 4px; }
.cosmetic-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; border: 1px solid var(--tag); color: var(--tag); border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 800; overflow-wrap: anywhere; }

body.has-backdrop::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(11, 10, 20, .35), rgba(11, 10, 20, .8)), var(--backdrop) center / cover no-repeat;
}

/* Animated art. The global reduced-motion rules at the top of this file turn all of it off. */
.scene.pop img { animation: portrait-in .35s ease both, portrait-idle 5s ease-in-out .35s infinite; }
.persona.pop img { animation: emblem-reveal .7s cubic-bezier(.2, 1.5, .4, 1) both, emblem-glow 3.5s ease-in-out .7s infinite; }
body.has-backdrop::before { animation: backdrop-drift 40s ease-in-out infinite alternate; }
@keyframes portrait-in { from { opacity: 0; transform: translateY(10px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes portrait-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes emblem-reveal { from { opacity: 0; transform: scale(.4) rotate(-14deg); } to { opacity: 1; transform: none; } }
@keyframes emblem-glow { 0%, 100% { filter: drop-shadow(0 0 2px var(--accent)); } 50% { filter: drop-shadow(0 0 12px var(--accent)); } }
@keyframes backdrop-drift { from { background-position: center, 42% center; } to { background-position: center, 58% center; } }

body.reduced-motion.has-backdrop::before { animation: none; }
@media (prefers-reduced-motion: reduce) { body.has-backdrop::before { animation: none; } }

/* Mobile usability: tab labels stay readable, and everything tappable is at least 44px. */
#nav a { font-size: .75rem; max-width: 96px; min-height: 56px; justify-content: center; }
#nav a span:first-child { font-size: 1.25rem; line-height: 1.2; }
a.small.muted { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; min-width: 44px; padding-right: 12px; }
.linkish { min-height: 44px; min-width: 44px; }
.setting select, select.report { min-height: 44px; }
.card > a:not(.btn) { display: block; min-height: 44px; }
.big-link { flex-direction: row; align-items: center; min-height: 64px; font-weight: 700; }
.big-link span { font-size: 1.4rem; }
.lang-bar { display: flex; gap: 6px; }
.lang { width: auto; min-width: 72px; min-height: 44px; padding: 6px 12px; font-weight: 600; }
.lang.selected { border-color: var(--pink); background: #3b1c3c; }

/* Khmer and Thai stack marks above and below letters, so they need more room and no tracking. */
html:lang(km) { font-size: calc(17px * var(--scale)); }
:lang(km) body, :lang(th) body { line-height: 1.7; }
:lang(km) .speaker, :lang(km) .brand, :lang(th) .speaker, :lang(th) .brand { letter-spacing: 0; text-transform: none; }
:lang(km) h1, :lang(th) h1, :lang(km) h2, :lang(th) h2 { line-height: 1.35; }
label.setting { min-height: 48px; }
.linkish { max-width: 100%; overflow-wrap: anywhere; }

/* MIRRIX look: neon violet glass, pill buttons, italic display headlines. */
.logo { font-style: italic; font-weight: 900; font-size: 1.75rem; letter-spacing: -.01em; line-height: 1; color: #fff; text-shadow: 0 0 14px var(--violet), 2px 2px 0 #6d28d9; }
.logo-big { font-size: 4.25rem; }
.display { font-style: italic; font-weight: 800; }
.gold { color: var(--gold); }
.prove { font-size: 1.75rem; transform: rotate(-3deg); }
:lang(km) .display, :lang(km) .logo, :lang(th) .display { font-style: normal; }

.splash { min-height: calc(100dvh - 48px); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-top: 14dvh; }
.splash-crown { width: 72px; height: auto; }
.splash p.display { font-size: 1.35rem; transform: rotate(-3deg); }
.splash-bar { width: 70%; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; margin-bottom: 16px; }
.splash-bar div { height: 100%; width: 40%; border-radius: 4px; background: #fff; animation: splash 1.2s ease-in-out infinite alternate; }
@keyframes splash { from { transform: translateX(-20%); } to { transform: translateX(170%); } }

.card { background: rgba(36, 16, 88, .86); border-color: rgba(150, 100, 255, .5); }
.card.hero { background: linear-gradient(135deg, rgba(90, 40, 200, .9), rgba(36, 16, 88, .92)); border-color: #a970ff; box-shadow: var(--glow); }
button, .btn { border-radius: 999px; background: rgba(51, 24, 122, .9); border-color: #8a5cf0; }
.primary { background: linear-gradient(95deg, #6d28d9, #a21caf); border: 2px solid #c79bff; color: #fff; box-shadow: var(--glow); }
.ghost { background: transparent; border-color: #b794ff; }
.danger { border-color: #a0405a; }
.linkish, .linkish:hover { border-radius: 8px; }

.option { display: flex; align-items: center; gap: 12px; background: #efe6ff; color: #1c0f3f; border: 0; border-radius: 18px; padding: 10px 16px 10px 10px; }
.option:hover { outline: 2px solid var(--pink); }
.option.selected { background: #ffd9f6; outline: 3px solid var(--pink); }
.option:not(:has(.letter)) { padding-left: 18px; }
.letter { flex: none; width: 32px; height: 32px; border-radius: 50%; background: #1c0f3f; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.question-bubble { background: rgba(245, 238, 255, .96); color: #1c0f3f; border-radius: 20px; padding: 16px 18px; font-size: 1.15rem; font-weight: 700; }
.question-bubble h2 { font-size: 1.15rem; color: inherit; }
.question-bubble .speaker { color: #7a1fa8; }
.question { font-size: 1.1rem; }

.screen-title { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 1.25rem; }
.back { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; margin-left: -10px; font-size: 1.6rem; line-height: 1; text-decoration: none; color: #fff; }
.icon-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(51, 24, 122, .85); text-decoration: none; }
.dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); }
.stack.tight { gap: 2px; min-width: 0; }

.ring { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 2px solid #d9b8ff; box-shadow: var(--glow); background: var(--surface-2); }
.ring .avatar { width: 100%; margin: 28% 0 0; }
.ring .avatar::before { display: none; }
.ring-big { width: 112px; height: 112px; }
.initial { background: hsl(var(--hue) 65% 42%); color: #fff; font-weight: 800; font-size: 1.4rem; }
.level { align-self: flex-start; background: var(--violet); color: #fff; border-radius: 8px; padding: 1px 8px; font-size: .75rem; font-weight: 800; }

.player-strip { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; background: rgba(36, 16, 88, .86); text-decoration: none; }
.drop-hero { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border-radius: 20px; text-decoration: none; overflow: hidden; border: 2px solid #a970ff; box-shadow: var(--glow); background: linear-gradient(rgba(36, 16, 88, .35), rgba(36, 16, 88, .85)), url("/art/backdrops/city.svg") center / cover; }
.drop-label { font-size: 1.05rem; }
.drop-title { font-size: 1.3rem; font-weight: 800; line-height: 1.25; }
.ribbon { position: absolute; top: 0; right: 0; background: var(--pink); color: #2a0620; font-weight: 800; font-size: .75rem; padding: 4px 14px; border-bottom-left-radius: 12px; }
.pill { display: inline-flex; align-items: center; min-height: 44px; gap: 6px; padding: 8px 18px; border-radius: 999px; background: linear-gradient(95deg, #6d28d9, #a21caf); border: 1px solid #c79bff; font-weight: 800; }
.small-pill { min-height: 36px; padding: 4px 12px; font-size: .85rem; flex: none; }

.mode-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; padding: 10px 6px; border-radius: 18px; text-align: center; text-decoration: none; font-weight: 800; font-size: .85rem; line-height: 1.2; border: 1px solid rgba(255, 255, 255, .28); overflow-wrap: anywhere; }
.mode-tile.tone-0 { background: linear-gradient(160deg, #b5179e, #7209b7); }
.mode-tile.tone-1 { background: linear-gradient(160deg, #0f6f96, #3a2a8a); }
.mode-tile.tone-2 { background: linear-gradient(160deg, #6d28d9, #3b1a9c); }
.mode-icon { font-size: 1.75rem; line-height: 1.1; }

.persona-strip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: rgba(36, 16, 88, .86); border: 1px solid rgba(150, 100, 255, .5); text-decoration: none; }
.persona-thumb { flex: none; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 14px; border: 2px solid var(--accent); background: var(--surface-2); }
.persona-thumb .emblem { width: 52px; height: 52px; }
.persona-name { font-size: 1.05rem; }
.persona-strip > .stack { flex: 1; }
.see-all { display: inline-flex; align-items: center; min-height: 44px; color: var(--aura); text-decoration: none; font-weight: 700; font-size: .875rem; }
.friend-row { display: flex; gap: 10px; overflow-x: auto; }
.friend-chip { text-decoration: none; flex: none; }

.persona { border: 0; background: transparent; padding: 8px 0; align-items: stretch; }
.persona h1 { color: #fff; font-size: 2.3rem; text-transform: uppercase; text-shadow: 0 0 14px var(--accent); }
.persona-kicker { color: #e8d4ff; font-size: 1.15rem; }
.crown { align-self: center; width: 64px; height: 48px; margin-bottom: -12px; position: relative; filter: drop-shadow(0 0 8px var(--gold)); }
.persona-frame { align-self: center; display: grid; place-items: center; width: min(68%, 240px); aspect-ratio: 1; border-radius: 26px; border: 3px solid var(--accent); box-shadow: 0 0 24px var(--accent); background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, var(--surface)), var(--surface)); }
.persona-frame .emblem { width: 72%; height: auto; aspect-ratio: 1; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(36, 16, 88, .86); font-size: 1.2rem; }
.stat-icon { font-size: 1.8rem; line-height: 1; }

.meter { display: grid; grid-template-columns: minmax(0, 7.5rem) 1fr 2.75rem; align-items: center; gap: 10px; font-size: .875rem; min-height: 28px; }
.meter > strong { text-align: right; }
.meter-track { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.tone-0 .meter-fill { background: linear-gradient(90deg, #2d7bff, #46c8ff); }
.tone-1 .meter-fill { background: linear-gradient(90deg, #d916c8, #ff5fd8); }
.tone-2 .meter-fill { background: linear-gradient(90deg, #6d3dff, #b78bff); }

.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.duel-side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.duel .ring { width: 104px; height: 104px; }
.duel .initial { font-size: 2.6rem; }
.duel-mid.heart { font-size: 2.5rem; color: var(--pink); text-shadow: 0 0 14px var(--pink); }
.duel-mid.vs { font-size: 3rem; font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 0 12px var(--aura), 3px 3px 0 #b5179e; }
.match-level { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: linear-gradient(95deg, rgba(160, 30, 170, .55), rgba(60, 25, 150, .85)); border: 1px solid #a970ff; }
.heart-big { font-size: 2.6rem; line-height: 1; }
.match-level .display { font-size: 1.5rem; }
.friend-card, .entry { flex-direction: row; align-items: center; gap: 12px; }
.entry-icon { flex: none; font-size: 1.6rem; width: 2.25rem; text-align: center; }
.create-action { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; font-size: 1.05rem; }

.profile-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: -40px; }
.profile-head .level { align-self: center; }
.banner { padding: 12px; border-radius: 999px; text-align: center; font-weight: 800; background: linear-gradient(95deg, #6d28d9, #a21caf); box-shadow: var(--glow); }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.profile-stat { display: flex; flex-direction: column; }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; min-width: 0; min-height: 44px; padding: 6px 8px; font-size: .875rem; font-weight: 700; background: rgba(36, 16, 88, .86); border-color: rgba(150, 100, 255, .5); }
.tab.selected { background: #efe6ff; color: #1c0f3f; }
.persona-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.persona-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; border: 2px solid var(--accent); background: rgba(36, 16, 88, .86); text-decoration: none; text-align: center; font-weight: 800; font-size: .8rem; text-transform: uppercase; overflow-wrap: anywhere; }
.persona-tile .emblem { width: 3.75rem; height: 3.75rem; }
.reward { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(95deg, rgba(109, 40, 217, .9), rgba(60, 25, 150, .9)); border: 1px solid #a970ff; }
.reward-icon { font-size: 2.2rem; line-height: 1; }

.episode-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.episode-bar div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #a21caf, #ff5fd8); }
.portrait { width: min(62vw, 15rem); height: auto; aspect-ratio: 1; border-radius: 24px; box-shadow: 0 0 22px rgba(170, 80, 255, .7); }
.speaker-row { flex-direction: column; align-items: flex-start; }
.line { background: rgba(36, 16, 88, .9); border-radius: 18px; padding: 14px 16px; }
.speaker { color: #f0a8ff; }

/* The tab bar, with the raised + in the middle. */
#nav { background: rgba(18, 6, 46, .96); border-top-color: rgba(150, 100, 255, .4); }
#nav .tab-icon { display: block; height: 24px; }
#nav a[aria-current="page"] { color: #f0a8ff; }
#nav a.fab { flex: none; width: 60px; height: 60px; min-height: 60px; margin: -18px 6px 4px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #8b3dff, #d916c8); border: 3px solid #e3c7ff; box-shadow: var(--glow); }
#toast { bottom: 96px; }

.group-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.group-tile { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px; border-radius: 16px; background: rgba(36, 16, 88, .86); border: 1px solid rgba(150, 100, 255, .5); text-decoration: none; overflow-wrap: anywhere; }
.rank-row { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px; border-radius: 16px; background: rgba(36, 16, 88, .86); }
.rank-row.me { outline: 2px solid var(--pink); }
.rank-row .ring { width: 44px; height: 44px; font-size: 1.1rem; }
.rank-number { width: 1.75rem; text-align: center; flex: none; }
.rank-name { flex: 1; overflow-wrap: anywhere; }
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-replies .mini { flex: 1 1 40%; }

/* Form states and switches */
input[type="text"] { background: rgba(18, 6, 46, .85); border-color: var(--line); }
input[type="text"]:focus { outline: none; border-color: #c79bff; box-shadow: var(--glow); }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 10px rgba(247, 93, 93, .6); }
.error { color: #ffb0b0; }
.setting input[type="checkbox"] { appearance: none; width: 48px; height: 28px; flex: none; margin: 0; border-radius: 14px; background: rgba(255, 255, 255, .22); position: relative; cursor: pointer; transition: background .15s ease; }
.setting input[type="checkbox"]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.setting input[type="checkbox"]:checked { background: linear-gradient(95deg, #6d28d9, #d916c8); }
.setting input[type="checkbox"]:checked::after { transform: translateX(20px); }
.setting select { background: rgba(18, 6, 46, .85); }

/* Friend comparison wheel */
.wheel { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; border: 2px solid rgba(170, 110, 255, .6); box-shadow: var(--glow), inset 0 0 40px rgba(139, 61, 255, .35); background: radial-gradient(circle, rgba(90, 40, 200, .55), rgba(36, 16, 88, .75)); }
.wheel-centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.wheel-centre .ring { width: 84px; height: 84px; }
.wheel-friend { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; min-width: 48px; min-height: 48px; text-decoration: none; }
.wheel-friend .ring { width: 48px; height: 48px; font-size: 1.1rem; }
.wheel-score { font-size: .75rem; font-weight: 800; }

/* The 7-day reward. The reveal is the same short animation every time, never a random wait. */
.reward-week { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 18px; background: linear-gradient(95deg, rgba(109, 40, 217, .9), rgba(60, 25, 150, .9)); border: 1px solid #a970ff; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-day { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; background: rgba(18, 6, 46, .6); font-weight: 800; font-size: .85rem; }
.week-day.done { background: var(--gold); color: #2a1a00; }

/* Neon icon set (js/icons.js). Sized in em, so an icon follows the text around it. */
.ni { display: inline-block; flex: none; width: 1.2em; height: 1.2em; vertical-align: -.24em; }
.ni svg { display: block; width: 100%; height: 100%; }
.ni-flame { color: #ff8a3d; }
.ni-drop { color: #3dd6ff; }
.ni-spark, .ni-trophy, .ni-medal { color: var(--gold, #ffd34d); }
.ni-heart { color: var(--pink, #ff5fa2); }
.ni-warning { color: #ffb020; }
button.primary .ni, .btn.primary .ni, .pill .ni, #nav .ni { color: inherit; }
.mode-icon .ni, .reward-icon .ni, .stat-icon .ni, .entry-icon .ni, .heart-big .ni, .duel-mid .ni, .screen-title > .ni { filter: drop-shadow(0 0 6px currentColor); }
#nav .tab-icon .ni { display: block; width: 24px; height: 24px; }
.place-2 .ni { color: #d5d9e6; }
.place-3 .ni { color: #d98a4f; }
