/* Windows doesn't draw flag emoji natively; this font only covers the flag code points. */
@font-face {
  font-family: 'Twemoji Country Flags';
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #17111f;
  --bg2: #1f1729;
  --panel: #2a2035;
  --panel2: #342843;
  --line: #43355a;
  --text: #f3edf9;
  --muted: #a99bbd;
  --pink: #ff66ab;
  --pink2: #ff8fc4;
  --blue: #66ccff;
  --purple: #b388ff;
  --green: #8fe3a0;
  --yellow: #ffd166;
  --red: #ff4d6a;
  --radius: 16px;
  --font: 'Twemoji Country Flags', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #3a1f45 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}
body.mg-open { overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; justify-content: center; }

/* ambient floating hit circles */
.bg-circles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-circles i {
  position: absolute; border-radius: 50%; border: 3px solid rgba(255, 102, 171, 0.12);
  animation: drift 24s linear infinite;
}
.bg-circles i:nth-child(1) { width: 180px; height: 180px; left: 5%; top: 70%; }
.bg-circles i:nth-child(2) { width: 90px; height: 90px; left: 80%; top: 20%; animation-duration: 18s; border-color: rgba(102, 204, 255, 0.12); }
.bg-circles i:nth-child(3) { width: 260px; height: 260px; left: 65%; top: 75%; animation-duration: 30s; }
.bg-circles i:nth-child(4) { width: 60px; height: 60px; left: 20%; top: 15%; animation-duration: 14s; border-color: rgba(179, 136, 255, 0.15); }
.bg-circles i:nth-child(5) { width: 120px; height: 120px; left: 40%; top: 45%; animation-duration: 22s; border-color: rgba(102, 204, 255, 0.08); }
@keyframes drift {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-120vh) scale(1.3); opacity: 0; }
}

/* layers */
#fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#flash { position: fixed; inset: 0; z-index: 55; pointer-events: none; opacity: 0; }
#flash.flash-good { animation: flash 0.5s ease-out; background: radial-gradient(circle, rgba(255, 102, 171, 0.25), transparent 70%); }
#flash.flash-neutral { animation: flash 0.5s ease-out; background: radial-gradient(circle, rgba(102, 204, 255, 0.18), transparent 70%); }
#flash.flash-bad { animation: flash 0.5s ease-out; background: radial-gradient(circle, rgba(255, 77, 106, 0.3), transparent 70%); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

#splash {
  position: fixed; inset: 0; z-index: 58; display: grid; place-content: center; text-align: center;
  pointer-events: none; opacity: 0;
}
#splash.show { animation: splash 1.6s cubic-bezier(.2, .8, .2, 1) forwards; }
#splash .sp-big { font-size: clamp(64px, 18vw, 150px); font-weight: 900; line-height: 1; letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 102, 171, 0.5)); }
#splash.gold .sp-big { background: linear-gradient(90deg, var(--yellow), #fff3c4, var(--yellow)); -webkit-background-clip: text; background-clip: text; }
#splash .sp-k { font-weight: 800; text-transform: uppercase; letter-spacing: 0.25em; color: var(--text); font-size: 0.95rem; text-shadow: 0 2px 10px #000; }
@keyframes splash {
  0% { opacity: 0; transform: scale(1.6); }
  18% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(0.98); }
  100% { opacity: 0; transform: scale(0.9); }
}

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(23, 17, 31, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; background: none; border: 0; cursor: pointer; font-weight: 800; font-size: 1.1rem; padding: 0; }
.brand-dot {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: 0.8rem; font-weight: 900; box-shadow: 0 0 0 3px #fff inset, 0 0 18px rgba(255, 102, 171, 0.6);
}
.icon-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }

main { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 16px 16px 24px; }

/* credit badge */
.site-foot { position: relative; z-index: 1; display: flex; justify-content: center; padding: 8px 16px 40px; }
.x-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none;
  font-size: 0.85rem; font-weight: 700; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.x-badge svg { width: 15px; height: 15px; }
.x-badge b { color: var(--pink2); }
.x-badge:hover { border-color: var(--pink); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 102, 171, 0.25); }
.x-badge:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.screen { display: flex; flex-direction: column; gap: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* buttons */
.btn {
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 800; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s; touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(90deg, var(--pink), #ff7fbf); color: #fff; box-shadow: 0 6px 20px rgba(255, 102, 171, 0.35); }
.btn.primary:hover { box-shadow: 0 8px 28px rgba(255, 102, 171, 0.55); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { color: #ff9aac; border-color: #6a3045; }
.btn.big { padding: 16px 32px; font-size: 1.1rem; }
.btn.choice {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-weight: 700;
}
.btn.choice:hover:not(:disabled) { border-color: var(--pink); background: #3d2d4f; transform: translateX(3px); }
.btn.choice:disabled { opacity: 0.45; cursor: not-allowed; }
.odds { flex: none; font-size: 0.8rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(102, 204, 255, 0.15); color: var(--blue); }
.odds.lock { background: rgba(255, 77, 106, 0.15); color: #ff9aac; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.choices.row { flex-direction: row; flex-wrap: wrap; }

/* creation */
.hero { text-align: center; padding: 18px 0 4px; }
.hero h1 { margin: 10px 0 4px; font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 900; }
.logo-circle {
  margin: 0 auto; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink); font-weight: 900; font-size: 1.6rem; box-shadow: 0 0 0 6px #fff inset, 0 0 40px rgba(255, 102, 171, 0.6);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }
input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
}
input:focus { border-color: var(--pink); }
#c-search { margin-bottom: 10px; }
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.flag-btn {
  display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; font-size: 0.85rem; font-weight: 700; text-align: left;
}
.flag-btn .flag { font-size: 1.4rem; line-height: 1; }
.flag-btn:hover { border-color: var(--blue); }
.flag-btn.sel, .opt.sel { border-color: var(--pink); background: #3a2240; box-shadow: 0 0 0 2px var(--pink) inset; }
.opt-grid, .focus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt, .focus {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; transition: transform 0.12s, border-color 0.12s;
}
.opt:hover, .focus:hover { border-color: var(--pink); transform: translateY(-2px); }
.opt small, .focus small { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.f-emoji { font-size: 1.6rem; line-height: 1.2; }

/* profile */
.profile { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem;
  background: var(--panel2); box-shadow: 0 0 0 3px var(--pink); flex: none;
}
.pf-info { flex: 1; min-width: 0; }
.pf-name { font-weight: 900; font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-year { text-align: right; display: flex; flex-direction: column; }
.pf-year b { font-size: 1.6rem; font-weight: 900; line-height: 1; color: var(--pink2); }
.yearbar { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; }
.yearbar i { height: 6px; border-radius: 3px; background: var(--panel2); }
.yearbar i.done { background: var(--purple); }
.yearbar i.now { background: var(--pink); box-shadow: 0 0 10px var(--pink); }

/* stats */
.rank-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.big-stat { background: var(--bg2); border-radius: 12px; padding: 10px 12px; min-width: 0; transition: box-shadow 0.3s; }
.big-stat small { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big-stat b { display: block; font-size: clamp(1.05rem, 4.5vw, 1.5rem); font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#st-pp { color: var(--pink2); }
#st-rank { color: var(--blue); }
.stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 30px; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; border-radius: 8px; }
.bar-row b { text-align: right; }
.bar { height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.m-fame .bar i { background: linear-gradient(90deg, #e0a030, var(--yellow)); }
.m-mot .bar i { background: linear-gradient(90deg, #ff7a45, #ffb35c); }
.m-wrist .bar i { background: linear-gradient(90deg, #3aa3d8, var(--blue)); }
.bar-row.danger b, .bar-row.danger span { color: var(--red); }
.bar-row.danger .bar i { background: var(--red); animation: blink 0.8s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.money-row { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.85rem; padding-top: 2px; }
.money-row b { color: var(--green); font-size: 1rem; margin-left: auto; }
.btn.mini {
  padding: 6px 12px; font-size: 0.8rem; background: rgba(143, 227, 160, 0.14); color: var(--green);
  border: 1px solid rgba(143, 227, 160, 0.4);
}
.btn.mini:hover { background: rgba(143, 227, 160, 0.25); }

/* shop */
.shop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 16, 0.88); backdrop-filter: blur(6px); overflow-y: auto; padding: 16px; }
.shop-panel {
  max-width: 820px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.shop-panel.enter { animation: cardIn 0.35s cubic-bezier(.2, .9, .3, 1.2); }
.shop-head { display: flex; align-items: center; gap: 12px; position: sticky; top: -18px; background: var(--panel); padding: 6px 0 10px; z-index: 1; }
.shop-head > div:first-child { flex: 1; }
.shop-head h2 { margin: 0; font-size: 1.5rem; font-weight: 900; }
.shop-money { font-weight: 900; font-size: 1.15rem; color: var(--green); background: var(--bg2); padding: 6px 12px; border-radius: 999px; }
.device-switch { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  flex: 1 1 120px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  font-weight: 800; font-size: 0.85rem; cursor: pointer;
}
.seg-btn.active { border-color: var(--pink); background: #3a2240; box-shadow: 0 0 0 2px var(--pink) inset; }
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.shop-cat { margin: 18px 0 8px; font-size: 1.05rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.shop-item {
  display: flex; flex-direction: column; gap: 8px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px;
}
.shop-item .chips { margin-top: 0; }
.shop-item .btn { margin-top: auto; padding: 9px 14px; }
.shop-item.maxed { border-color: rgba(255, 209, 102, 0.45); }
.si-top { display: flex; gap: 10px; align-items: center; }
.si-emoji { font-size: 1.7rem; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); }
.si-name { display: flex; flex-direction: column; min-width: 0; }
.si-name small { font-size: 0.75rem; }
.pips { display: flex; gap: 3px; margin-top: 3px; }
.pips i { width: 18px; height: 5px; border-radius: 3px; background: var(--panel2); }
.pips i.on { background: var(--yellow); box-shadow: 0 0 6px rgba(255, 209, 102, 0.6); }
.up { animation: up 0.9s ease-out; }
.down { animation: down 0.9s ease-out; }
@keyframes up { 0% { background: rgba(143, 227, 160, 0.35); box-shadow: 0 0 0 2px rgba(143, 227, 160, 0.6); } 100% { background: transparent; box-shadow: none; } }
@keyframes down { 0% { background: rgba(255, 77, 106, 0.35); box-shadow: 0 0 0 2px rgba(255, 77, 106, 0.6); } 100% { background: transparent; box-shadow: none; } }

/* stage / cards */
.stage { min-height: 260px; }
.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue));
}
.card.history::before { background: linear-gradient(90deg, var(--yellow), var(--pink)); }
.card.owc::before { background: linear-gradient(90deg, var(--yellow), #fff3c4, var(--yellow)); height: 4px; }
.card.result-good { border-color: rgba(255, 102, 171, 0.6); box-shadow: 0 0 30px rgba(255, 102, 171, 0.15); }
.card.result-bad { border-color: rgba(255, 77, 106, 0.6); box-shadow: 0 0 30px rgba(255, 77, 106, 0.15); }
.card-in { animation: cardIn 0.45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.shake { animation: shake 0.45s; }
@keyframes shake {
  20% { transform: translateX(-8px) rotate(-0.6deg); } 40% { transform: translateX(7px) rotate(0.5deg); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } 100% { transform: none; }
}
.card-head { display: flex; gap: 12px; align-items: center; }
.card-emoji {
  flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem;
  background: var(--bg2); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 16px rgba(255, 102, 171, 0.4);
}
.kicker { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card h3 { margin: 2px 0 0; font-size: 1.25rem; font-weight: 900; line-height: 1.2; }
.card-text { margin: 14px 0 0; font-size: 1.02rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 0.8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); }
.chip.pos { color: var(--green); border-color: rgba(143, 227, 160, 0.4); }
.chip.neg { color: #ff8a9c; border-color: rgba(255, 77, 106, 0.4); }
.pill { font-size: 0.7rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.05em; }
.pill.pos { background: rgba(143, 227, 160, 0.18); color: var(--green); }
.pill.neg { background: rgba(255, 77, 106, 0.18); color: #ff8a9c; }
.focus-grid { margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.bracket { display: flex; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.bracket span { flex: 1 1 0; min-width: 80px; text-align: center; font-size: 0.72rem; font-weight: 800; padding: 6px 4px; border-radius: 8px; background: var(--bg2); color: var(--muted); }
.bracket .won { background: rgba(143, 227, 160, 0.18); color: var(--green); }
.bracket .now { background: rgba(255, 209, 102, 0.2); color: var(--yellow); box-shadow: 0 0 0 1px var(--yellow) inset; }
.bracket .lost { background: rgba(255, 77, 106, 0.2); color: #ff8a9c; }

.log-panel summary { cursor: pointer; font-weight: 800; }
.log { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.log li { display: grid; grid-template-columns: 44px 24px 1fr; gap: 6px; font-size: 0.88rem; }
.log-y { color: var(--muted); font-weight: 800; }

/* end screen */
.end-hero { text-align: center; padding: 10px 0; }
.end-flag { font-size: 4rem; line-height: 1; }
.end-hero h1 { margin: 4px 0; font-size: clamp(2rem, 8vw, 3rem); font-weight: 900; word-break: break-word; }
.end-title { display: inline-block; font-size: 1.2rem; font-weight: 900; padding: 6px 16px; border-radius: 999px; background: linear-gradient(90deg, var(--pink), var(--purple)); }
.end-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.end-grid .big-stat { background: var(--panel); border: 1px solid var(--line); }
.owc-list { margin: 0; padding-left: 18px; }
.share { white-space: pre-wrap; background: var(--bg2); border-radius: 12px; padding: 12px; margin: 0; font-family: var(--font); font-size: 0.9rem; }
.hof-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.hof-filters select {
  width: 100%; min-width: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; color: var(--text); font: inherit; font-size: 0.85rem;
}
.hof-submit { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 12px; }
.hof { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: hof; }
.hof li { display: grid; grid-template-columns: 28px 36px 1fr auto; gap: 8px; align-items: center; background: var(--bg2); border-radius: 10px; padding: 8px 10px; counter-increment: hof; }
.hof li::before { content: counter(hof); font-weight: 900; color: var(--muted); text-align: center; }
.hof li.me { box-shadow: 0 0 0 2px var(--pink) inset; }
.hof-flag { font-size: 1.5rem; }
.hof-name, .hof-num { display: flex; flex-direction: column; min-width: 0; }
.hof-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hof-name small, .hof-num small { color: var(--muted); font-size: 0.75rem; }
.hof-num { text-align: right; font-weight: 900; }

/* minigame overlay */
.mg { position: fixed; inset: 0; z-index: 50; display: none; background: rgba(10, 6, 16, 0.92); backdrop-filter: blur(6px); padding: 12px; }
.mg.open { display: grid; place-items: center; }
.mg-panel { width: min(960px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.mg-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.mg-head h2 { margin: 0; font-size: clamp(1.1rem, 4vw, 1.5rem); font-weight: 900; }
.mg-kicker { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--pink2); }
.mg-hud { display: flex; gap: 12px; font-weight: 900; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
#mg-combo { color: var(--yellow); min-width: 3ch; text-align: right; }
.mg-stage { position: relative; display: flex; justify-content: center; }
#mg-canvas { display: block; border-radius: 14px; touch-action: none; cursor: none; box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.5); }
.mg-intro, .mg-result {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 14px; padding: 20px; background: rgba(20, 13, 31, 0.88); border-radius: 14px;
}
.mg-intro p { max-width: 480px; font-size: 1.05rem; margin: 0; }
.mg-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 1px 7px; font-family: inherit; font-weight: 800; }
.grade { font-size: clamp(80px, 20vw, 140px); font-weight: 900; line-height: 1; animation: gradeIn 0.6s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes gradeIn { from { transform: scale(2.4) rotate(-10deg); opacity: 0; } to { transform: none; opacity: 1; } }
.grade-SS, .grade-S { color: var(--yellow); text-shadow: 0 0 30px rgba(255, 209, 102, 0.7); }
.grade-A { color: var(--green); text-shadow: 0 0 30px rgba(143, 227, 160, 0.5); }
.grade-B { color: var(--blue); }
.grade-C { color: var(--purple); }
.grade-D { color: var(--red); }
.mg-res-acc { font-size: 1.4rem; font-weight: 900; }
.mg-counts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; font-weight: 800; font-size: 0.9rem; }
.j300 { color: var(--blue); } .j100 { color: var(--green); } .j50 { color: #ffb35c; } .jmiss { color: var(--red); }

@media (max-width: 560px) {
  .stat-cols { grid-template-columns: 1fr; gap: 8px; }
  .bar-row { grid-template-columns: 96px 1fr 28px; }
  .end-grid { grid-template-columns: repeat(2, 1fr); }
  .rank-row { gap: 6px; }
  .big-stat { padding: 8px; }
  .card { padding: 14px; }
  .focus-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
