:root { --dock-height: 62px; }

[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--lime); outline-offset: 3px; }
.view.is-active { animation-name: duo-view-in; }
@keyframes duo-view-in { from { opacity: 0; } to { opacity: 1; } }

.duo-dock {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: var(--dock-height);
  padding: 8px clamp(12px, 3vw, 34px);
  border-bottom: 1px solid #ffffff25;
  background: #190b28e8;
  backdrop-filter: blur(18px);
}
.duo-players, .duo-controls { display: flex; gap: 8px; align-items: center; }
.duo-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #ffffff24;
  border-radius: 8px;
  background: #ffffff0b;
  font-size: 0.8rem;
}
.duo-player small { color: var(--muted); }
.player-dot { display: inline-block; width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--player-color); }
.duo-player:not(.is-online) .player-dot { background: transparent; border: 1px solid #ffffff70; }
.duo-player.is-online .player-dot { box-shadow: 0 0 10px var(--player-color); }
.color-control, .photo-control, .sign-out {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  gap: 7px;
  padding: 0 7px;
  border: 1px solid #ffffff24;
  border-radius: 8px;
  background: #ffffff0b;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.color-control:hover, .photo-control:hover, .sign-out:hover { background: #ffffff22; }
.color-control input { padding: 0; width: 23px; height: 24px; border: 0; background: transparent; cursor: pointer; }
.color-control input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-control input::-webkit-color-swatch { border: 1px solid #ffffff70; border-radius: 50%; }
.photo-control { padding: 0 4px; }
.photo-control::after { position: absolute; right: 1px; bottom: 1px; content: "+"; width: 12px; height: 12px; border: 1px solid #ffffff80; border-radius: 50%; background: #29173b; font-size: 0.58rem; line-height: 10px; text-align: center; pointer-events: none; }
.photo-control input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.player-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--avatar-size, 26px);
  height: var(--avatar-size, 26px);
  overflow: hidden;
  border: 2px solid var(--player-color);
  border-radius: 50%;
  background: #22152f;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}
.player-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.connection-strip, .photo-notice {
  position: fixed;
  top: calc(var(--dock-height) + 6px);
  right: 12px;
  z-index: 42;
  margin: 0;
  padding: 9px 13px;
  max-width: min(320px, calc(100% - 24px));
  border-radius: 8px;
  background: #251331;
  border: 1px solid #ffffff38;
  font-size: 0.8rem;
  font-weight: 700;
}
.photo-notice { top: auto; bottom: 16px; }

.home-view, .game-view, .summary-view { min-height: calc(100dvh - var(--dock-height)); }
.home-hero { min-height: 575px; }
.lobby-status { min-height: 1.4em; margin: 13px 0 0; color: #fff5fc; font-size: 0.87rem; font-weight: 700; }
.discover-button:disabled::before { animation: none; }
.game-view { padding: 88px 0 22px; align-items: flex-start; }
.game-topbar { position: absolute; padding-top: 12px; }
.rail { position: absolute; top: 89px; pointer-events: auto; }
.rail-heading { display: grid; place-items: center; min-height: 35px; white-space: nowrap; }
.rail-items { overflow: hidden auto; scrollbar-width: thin; overscroll-behavior: contain; mask-image: none; }
.rail-card { display: flex; flex-direction: column; justify-content: space-between; align-items: center; border-radius: 8px; padding: 5px 2px; }
.rail-card::after { content: none; }
.rail-card > img { height: 66%; }
.rail-avatars { display: flex; justify-content: center; gap: 3px; }
.rail-avatars .player-avatar { --avatar-size: 23px; }
.game-stage { gap: 12px; }
.deck { height: min(600px, calc(100dvh - 270px)); min-height: 355px; }
.profile-card.is-next > * { visibility: hidden; }
.creature-figure { overflow: hidden; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.creature-figure img { min-width: 0; min-height: 0; }
.profile-card.is-locked { cursor: default; }
.profile-card.is-revealed { border-color: #fff6; }
.action-row { width: min(100%, 292px); margin-inline: auto; gap: 10px; }
.round-action { aspect-ratio: auto; height: 62px; gap: 4px; align-content: center; border-radius: 8px; }
.round-action span { font-size: 1.9rem; }
.turn-votes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.turn-vote {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 3px 6px;
  min-height: 49px;
  padding: 6px 9px;
  border: 1px solid #ffffff27;
  border-radius: 8px;
  background: #210d31dd;
  font-size: 0.8rem;
}
.turn-vote span { grid-column: 2; color: var(--muted); font-size: 0.72rem; }
.turn-vote.smash span, .summary-votes .smash { color: #ff9bd5; }
.turn-vote.pass span, .summary-votes .pass { color: #77f1ff; }
.turn-votes.is-revealed .turn-vote { animation: duo-reveal 420ms cubic-bezier(0.15, 1.1, 0.45, 1); border-color: #fff7; }
@keyframes duo-reveal { from { transform: scale(0.94); } to { transform: scale(1); } }

.presence-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.remote-cursor {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 12px;
  height: 12px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--player-color);
  box-shadow: 0 0 10px var(--player-color);
  transition: transform 75ms linear;
}
.cursor-avatar, .cursor-name { position: absolute; top: 50%; transform: translateY(-50%); }
.cursor-avatar { left: 16px; }
.cursor-avatar .player-avatar { --avatar-size: 29px; box-shadow: 0 4px 12px #0007; }
.cursor-name { left: 50px; padding: 3px 5px; border-radius: 4px; background: #1d1027; color: #fff; font-size: 0.64rem; font-weight: 800; }
.remote-cursor.is-flipped .cursor-avatar { left: auto; right: 16px; }
.remote-cursor.is-flipped .cursor-name { left: auto; right: 50px; }
.pointer-wave {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid var(--player-color);
  border-radius: 50%;
  box-shadow: 0 0 18px var(--player-color), inset 0 0 8px var(--player-color);
  transform: translate(-50%, -50%);
  animation: duo-wave 820ms cubic-bezier(0.18, 0.72, 0.28, 1) both;
}
@keyframes duo-wave {
  from { opacity: 1; transform: translate(-50%, -50%) scale(0.32); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(5.2); }
}

.summary-view { max-width: 1450px; margin-inline: auto; }
.summary-header h2 { font-size: 3rem; line-height: 1; }
.stats-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: stretch; padding-block: 14px; border-block: 1px solid #ffffff35; }
.compatibility-stat { display: flex; gap: 18px; align-items: center; }
.compatibility-stat > strong {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  align-content: center;
  width: 104px;
  height: 104px;
  padding-top: 27px;
  border: 4px solid transparent;
  border-radius: 50%;
  background: linear-gradient(#251333, #251333) padding-box, conic-gradient(var(--lime) 0 var(--match), #50315f var(--match) 100%) border-box;
  font-size: 2rem;
  font-weight: 900;
}
.compatibility-stat small { font-size: 0.9rem; }
.compatibility-stat h3, .compatibility-stat p, .summary-tools h3 { margin: 0; }
.compatibility-stat p { margin-top: 4px; color: #fffbdc; font-size: 0.87rem; }
.breakdown-stat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 8px; }
.breakdown-stat div { display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border-left: 1px solid #ffffff25; text-align: center; }
.breakdown-stat strong { font-size: 1.45rem; }
.breakdown-stat span { font-size: 0.76rem; color: #fffaf0; line-height: 1.15; }
.duo-favorites { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.duo-result { display: flex; justify-content: space-between; align-items: center; min-height: 110px; gap: 5px; border: 1px solid #ffffff25; border-top: 2px solid var(--player-color); border-radius: 8px; padding: 12px; background: #21122dc4; }
.duo-result h3, .duo-result p { margin: 0; }
.result-numbers { display: flex; flex-wrap: wrap; gap: 3px 9px; padding-top: 6px; font-size: 0.8rem; }
.result-numbers span:first-child { color: #ff9bd5; }
.result-numbers span:last-child { color: #77f1ff; }
.duo-result .result-favorite { margin-top: 6px; font-size: 0.79rem; font-weight: 700; }
.result-favorite span, .summary-star { color: var(--yellow); }
.duo-result img { width: min(35%, 125px); height: 78px; object-fit: contain; }
.summary-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.summary-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid #ffffff2b; border-radius: 8px; background: #241330c7; }
.summary-filters button { padding: 6px 8px; border-radius: 4px; background: transparent; font-size: 0.76rem; font-weight: 750; }
.summary-filters button[aria-pressed="true"] { color: #211230; background: var(--lime); }
.summary-grid { grid-template-columns: repeat(auto-fill, minmax(min(165px, 100%), 1fr)); }
.summary-card { grid-template-rows: 162px auto; border-radius: 8px; }
.summary-image { padding: 8px; }
.summary-image img { height: 146px; }
.summary-copy { min-width: 0; padding: 11px; background: #1f122bcc; }
.summary-copy h4 { margin: 0; font-size: 1rem; line-height: 1.15; overflow-wrap: anywhere; }
.summary-votes { display: grid; gap: 5px; }
.summary-votes > div { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 5px; font-size: 0.7rem; }
.summary-votes .player-avatar { --avatar-size: 20px; }
.empty-summary { margin: 0; grid-column: 1 / -1; }

.login-body { min-height: 100dvh; background: #1b0c26; }
.login-shell { position: relative; isolation: isolate; min-height: 100dvh; display: grid; align-items: center; padding: 110px max(24px, calc((100% - 1080px) / 2)) 52px; overflow: hidden; }
.login-brand { position: absolute; top: 24px; left: max(24px, calc((100% - 1080px) / 2)); right: max(24px, calc((100% - 1080px) / 2)); display: flex; justify-content: space-between; align-items: center; }
.login-art { position: absolute; inset: 0; z-index: -1; background: #3c1147; }
.login-art::after { position: absolute; inset: 0; content: ""; background: linear-gradient(90deg, #1b0c26 15%, #1b0c26d9 39%, #32103e00 80%); }
.login-art img { position: absolute; right: 2%; top: 7%; width: min(73%, 1050px); height: 90%; object-fit: contain; object-position: right center; filter: drop-shadow(0 20px 55px #0009); }
.login-content { width: min(100%, 430px); animation: heroCopyIn 600ms both; }
.login-content h1 { font-size: 4.6rem; line-height: 0.88; margin: 9px 0 28px; text-transform: uppercase; }
.login-content h1 span { display: block; color: #ff9bd5; }
.login-form { display: grid; gap: 12px; }
.login-form label { display: grid; gap: 5px; font-size: 0.88rem; font-weight: 750; }
.login-form input { min-width: 0; height: 45px; padding: 7px 11px; color: var(--white); font: inherit; border: 1px solid #ffffff50; border-radius: 8px; background: #190e23ed; }
.login-form button { justify-self: start; margin-top: 5px; border-radius: 8px; }
.login-error { margin: 0; min-height: 1.3em; color: #ffb8d1; font-size: 0.88rem; }

@media (max-width: 820px) {
  .rail { top: 90px; width: 54px; }
  .rail-avatars .player-avatar { --avatar-size: 17px; border-width: 1.5px; font-size: 0.56rem; }
  .game-stage { width: min(380px, calc(100% - 134px)); min-width: 0; }
}
@media (max-width: 560px) {
  :root { --dock-height: 52px; }
  .duo-dock { padding: 6px 9px; gap: 5px; }
  .duo-players, .duo-controls { gap: 4px; }
  .duo-player { padding: 6px; gap: 4px; font-size: 0.72rem; }
  .color-control > span { display: none; }
  .home-hero { min-height: 525px; }
  .game-view { padding-top: 66px; }
  .rail { top: 67px; width: 43px; gap: 5px; }
  .rail-items { padding: 0; gap: 5px; scrollbar-width: none; }
  .rail-heading { min-height: 28px; padding: 5px 0; font-size: 0.53rem; }
  .rail-card { min-height: 52px; }
  .game-stage { width: min(350px, calc(100% - 112px)); gap: 8px; }
  .deck { height: min(475px, calc(100dvh - 266px)); min-height: 325px; }
  .profile-copy { gap: 7px; padding: 11px; }
  .profile-copy h3 { font-size: 1.7rem; overflow-wrap: anywhere; }
  .tag-row { gap: 4px; }
  .tag-row span { padding: 4px 6px; }
  .round-action { height: 55px; }
  .summary-header h2 { font-size: 2.12rem; }
  .summary-header > div { flex-basis: 160px; }
  .stats-strip { grid-template-columns: 1fr; gap: 9px; }
  .compatibility-stat > strong { width: 90px; height: 90px; padding-top: 20px; }
  .breakdown-stat div:first-child { border-left: 0; }
  .duo-result { padding: 8px; }
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(min(138px, 100%), 1fr)); gap: 8px; }
  .summary-card { grid-template-rows: 124px auto; }
  .summary-image img { height: 108px; }
  .summary-copy { padding: 8px; }
  .login-shell { padding-top: 116px; }
  .login-content h1 { font-size: 3.45rem; }
  .login-art img { height: 63%; width: 98%; top: 3%; right: -14%; opacity: 0.52; }
  .login-art::after { background: linear-gradient(0deg, #1b0c26 20%, #1b0c2666 90%); }
}

@media (prefers-reduced-motion: reduce) {
  .pointer-wave { animation: none; opacity: 0.85; }
}
