:root {
  --bg: #f7f7f2;
  --ink: #242821;
  --muted: #73766d;
  --line: #dddfd5;
  --emoji-font: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  color-scheme: light;
  font-family: Arial, Helvetica, 'Noto Color Emoji', sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid #547b28;
  outline-offset: 5px;
}
.wrap { width: min(100% - 48px, 760px); margin: auto; }
.header { height: 100px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 23px; font-weight: 750; letter-spacing: -.9px; }
.brand span { color: #78964e; }
.view-tabs { display: flex; justify-content: center; gap: 4px; margin: 8px 0 24px; }
.view-tabs a { padding: 10px 18px; border-radius: 24px; font-size: 13px; color: var(--muted); }
.view-tabs a[aria-current="page"] { background: #e9ecdf; color: var(--ink); }
.view-tabs a:hover { color: var(--ink); }
.button { border: 0; border-radius: 30px; padding: 12px 19px; font-size: 13px; font-weight: 600; }
.button span { margin-left: 12px; }
.dark { background: var(--ink); color: #fff; }
.dark:hover { background: #424d35; }
h1 { font-size: 25px; font-weight: 600; letter-spacing: -.8px; text-align: center; margin: 30px 0 25px; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.4px; margin: 0; }
.arena { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; position: relative; }
.duo-card {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 230px;
  padding: 20px 12px;
  border: 1px solid transparent;
  border-radius: 24px;
  transition: transform .15s, border-color .15s;
}
.duo-card, .duo-card:disabled {
  opacity: 1;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}
.duo-card:not(:disabled):hover { transform: translateY(-3px); border-color: #24282140; }
.duo-card.selected { border-color: #637f3b; box-shadow: 0 0 0 2px #637f3b30; }
.duo-card.revealed { cursor: default; }
.duo-card.revealed:not(.selected) .duo,
.duo-card.revealed:not(.selected) .pair-percentage { opacity: .45; }
.duo-card.revealed .duo { transform: translateY(-14px); }
.duo-card.selected .duo { animation: choice-pop .45s ease-out; }
.duo { transition: transform .3s ease, opacity .3s ease; }
.pair-percentage { position: absolute; bottom: 22px; font-size: 26px; font-weight: 650; letter-spacing: -1px; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.revealed .pair-percentage { opacity: 1; transform: translateY(0); }
.vote-result { margin-top: 18px; animation: result-appear .3s ease-out; }
.result-track { height: 9px; background: #c9bdea; border-radius: 12px; overflow: hidden; }
.result-track span { display: block; height: 100%; width: 50%; background: #e8ae8a; transition: width .65s cubic-bezier(.22, 1, .36, 1); }
.result-caption { margin: 10px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
.vote-result:not([hidden]) + .arena-footer #status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.vote-result:not([hidden]) + .arena-footer { justify-content: flex-end; }
.notification { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; z-index: 10; max-width: calc(100% - 32px); padding: 13px 22px; border-radius: 30px; color: #fff; background: var(--ink); box-shadow: 0 8px 30px #24282120; font-size: 13px; text-align: center; pointer-events: none; opacity: 0; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.notification.visible { opacity: 1; transform: translate(-50%, 0); }
@keyframes choice-pop { 0% { transform: translateY(0) scale(1); } 45% { transform: translateY(-14px) scale(1.12); } 100% { transform: translateY(-14px) scale(1); } }
@keyframes result-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.peach { background: #f5ddce; }
.lavender { background: #e4e0f3; }
.duo { font-family: var(--emoji-font); font-size: clamp(48px, 9vw, 88px); line-height: 1.3; }
.versus {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 2px 6px #24282108;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .5px;
  pointer-events: none;
}
.arena-footer { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; min-height: 58px; padding-top: 12px; }
.text-button { border: 0; background: none; padding: 8px 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.status { min-height: 18px; margin: 0; font-size: 12px; line-height: 1.6; color: #596b3b; }
.status.error { color: #9c3b31; }
#leaderboard { padding-top: 28px; padding-bottom: 36px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.table-wrap { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
th { padding: 14px 20px; color: var(--muted); background: #f0f1e9; font-size: 11px; font-weight: 500; }
td { padding: 12px 20px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child { width: 58px; }
th:nth-child(n+3), td:nth-child(n+3) { text-align: right; }
.rank-number { color: var(--muted); }
.top-rank { color: var(--ink); font-weight: 600; }
.table-emoji { font-family: var(--emoji-font); font-size: 28px; white-space: nowrap; }
.score { font-weight: 600; }
.win-rate { color: var(--muted); }
.empty { text-align: center; padding: 25px; color: var(--muted); }
.table-footer { display: flex; justify-content: center; padding-top: 8px; }
dialog { width: min(420px, calc(100% - 32px)); padding: 30px; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: var(--bg); box-shadow: 0 24px 80px #24282125; }
dialog::backdrop { background: #24282166; backdrop-filter: blur(4px); }
dialog form { position: relative; }
dialog h2 { font-size: 24px; margin-bottom: 24px; }
dialog label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
dialog input { width: 100%; padding: 14px; border: 1px solid #bfc8ad; border-radius: 16px; background: #eef0e4; text-align: center; font-size: 44px; color: var(--ink); }
.close { position: absolute; top: -12px; right: -12px; background: none; border: 0; color: var(--muted); font-size: 25px; padding: 8px; }
.emoji-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 16px; }
.emoji-picker button { border: 0; border-radius: 9px; background: #eeeee6; font-size: 22px; padding: 8px 0; }
.emoji-picker button:hover { background: #d9ef9d; }
#emoji-input, .emoji-picker button { font-family: var(--emoji-font); }
.duo, .table-emoji, #emoji-input, .emoji-picker button { font-weight: 400; font-style: normal; }
dialog .status { margin: 6px 0 12px; }
.submit { width: 100%; }
[hidden] { display: none !important; }
@media (max-width: 520px) {
  .wrap { width: calc(100% - 32px); }
  .header { height: 80px; }
  .brand { font-size: 21px; }
  h1 { font-size: 22px; margin: 22px 0; }
  .arena { gap: 14px; }
  .duo-card { height: 175px; padding: 12px 4px; border-radius: 20px; }
  .duo { font-size: clamp(42px, 11vw, 57px); letter-spacing: 0; }
  .versus { width: 36px; height: 36px; font-size: 10px; }
  th, td { padding: 12px; }
  .wins-col { display: none; }
  th:first-child { width: 40px; }
  dialog { padding: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
