@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap");

@font-face {
  font-family: "OnePiece";
  src: url("./onepiece.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --font-ui: "Crimson Pro", Georgia, serif;
  --font-display: "Cinzel", Georgia, serif;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;

  --tileSize: 108px;
  --tileRadius: 16px;
  --content-width: min(1120px, 96vw);

  --ink: #f4eddc;
  --ink-muted: #917e5e;
  --ink-faint: #4e5c6e;
  --panel: rgba(7, 17, 32, 0.9);
  --panel-strong: rgba(10, 24, 46, 0.94);
  --gold: #c8991e;
  --gold-lt: #e8b82e;
  --gold-pale: #f4d878;
  --ui-blue-top: rgba(108, 176, 236, 0.95);
  --ui-blue-bottom: rgba(72, 143, 214, 0.95);
  --ui-blue-border: rgba(173, 221, 255, 0.65);
  --accent: #d74b3f;

  --green: #1f7a3b;
  --yellow: #b2871a;
  --red: #b83a3a;
  --grey: #3a3f4a;
  --border-soft: rgba(148, 122, 70, 0.2);
  --surface-soft: rgba(4, 12, 26, 0.9);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.28);
  --shadow-panel: 0 14px 34px rgba(0, 0, 0, 0.38);
  --app-vh: 100vh;

  --ease-smooth: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.srOnly {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
select,
textarea {
  font-size: 16px !important;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: calc(var(--app-vh));
  min-height: -webkit-fill-available;
  font-family: var(--font-ui);
  color: var(--ink);
  background: #081528;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body.modalLocked {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(230, 180, 84, 0.16), transparent 62%),
    radial-gradient(1000px 500px at 90% 100%, rgba(63, 126, 196, 0.14), transparent 66%),
    linear-gradient(to bottom, rgba(5, 12, 24, 0.88), rgba(5, 12, 24, 0.97)),
    url("bg.jpg") center/cover no-repeat;
  z-index: -1;
  overflow: hidden;
}

.bg::after {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(245, 230, 184, 0.05), transparent 32%),
    radial-gradient(circle at 78% 68%, rgba(120, 168, 223, 0.06), transparent 34%);
  filter: blur(24px);
  opacity: 0.68;
  animation: ambientDrift 18s ease-in-out infinite alternate;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-3) calc(56px + env(safe-area-inset-bottom));
  min-height: calc(var(--app-vh) - env(safe-area-inset-top));
  text-align: center;
  animation: pageIn 320ms var(--ease-smooth);
}

.container > * {
  margin-left: auto;
  margin-right: auto;
}

.gameShell {
  width: 100%;
}

.modeLanding {
  width: min(1080px, 100%);
  min-height: calc(var(--app-vh) - 140px - env(safe-area-inset-top));
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 36px) 0;
  touch-action: pan-y;
}

.modeLandingInner {
  width: min(960px, 100%);
  padding: clamp(22px, 4vw, 40px);
  border-radius: 28px;
  border: 1px solid rgba(173, 221, 255, 0.3);
  background:
    radial-gradient(circle at top right, rgba(108, 176, 236, 0.14), transparent 34%),
    linear-gradient(145deg, rgba(7, 18, 35, 0.96), rgba(7, 16, 31, 0.92));
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
}

.modeLandingEyebrow {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-pale);
}

.modeLandingTitle {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.04;
  text-align: left;
}

.modeLandingCopy {
  width: min(680px, 100%);
  margin: 16px 0 0;
  color: rgba(235, 242, 250, 0.86);
  font-size: 1.02rem;
  line-height: 1.55;
  text-align: left;
}

.modeLandingGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
  align-items: stretch;
}

.modeLandingCard {
  width: 100%;
  min-height: 130px;
  justify-content: flex-end;
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(108, 176, 236, 0.2), rgba(72, 143, 214, 0.14)),
    linear-gradient(180deg, rgba(7, 20, 39, 0.94), rgba(6, 16, 31, 0.98));
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 980px) {
  .modeLandingGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .modeLanding {
    min-height: auto;
    padding-top: 10px;
  }

  .modeLandingInner {
    padding: 18px;
    border-radius: 20px;
  }

  .modeLandingGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modeLandingCard {
    min-height: 110px;
  }
}

@media (max-width: 340px) {
  .modeLandingGrid {
    grid-template-columns: 1fr;
  }
}

h1 {
  margin: 0;
}

.topBar {
  position: sticky;
  top: 0;
  z-index: 80;
  border-bottom: 1px solid rgba(173, 221, 255, 0.24);
  background: rgba(3, 11, 22, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.topBarInner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 22px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brandLockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.brandTitleRow {
  display: flex;
  align-items: center;
  gap: 13px;
}

.logoEmblem {
  flex-shrink: 0;
  font-size: 2rem;
  line-height: 1;
  color: #ffffff;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.28));
  animation: skullFloat 4.5s ease-in-out infinite;
}

@keyframes skullFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}

.topBarActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.logo-title {
  font-family: "OnePiece", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(1.95rem, 3.6vw, 2.45rem);
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: 1px;
  position: relative;
  display: inline-block;
  text-shadow:
    -1.5px -1.5px 0 #000,
    1.5px -1.5px 0 #000,
    -1.5px 1.5px 0 #000,
    1.5px 1.5px 0 #000,
    0 3px 0 rgba(0, 0, 0, 0.62);
}

.logo-title .logo-one,
.logo-title .logo-piece,
.logo-title .logo-piece-main,
.logo-title .logo-piece-tail,
.logo-title .logo-dle {
  display: inline-block;
  line-height: 1;
}

.logo-title .logo-one {
  color: #5fa6d8;
  text-shadow:
    -1.5px -1.5px 0 #000,
    1.5px -1.5px 0 #000,
    -1.5px 1.5px 0 #000,
    1.5px 1.5px 0 #000,
    0 3px 0 rgba(0, 0, 0, 0.68);
}

.logo-title .logo-piece {
  margin-left: 0;
  margin-right: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}

.logo-title .logo-piece-main,
.logo-title .logo-piece-tail,
.logo-title .logo-dle {
  color: #5fa6d8;
  text-shadow:
    -1.5px -1.5px 0 #000,
    1.5px -1.5px 0 #000,
    -1.5px 1.5px 0 #000,
    1.5px 1.5px 0 #000,
    0 3px 0 rgba(0, 0, 0, 0.68);
}

.logo-title .logo-piece-i {
  display: inline-block;
  color: #cf3028;
  text-shadow:
    -1.5px -1.5px 0 #000,
    1.5px -1.5px 0 #000,
    -1.5px 1.5px 0 #000,
    1.5px 1.5px 0 #000,
    0 3px 0 rgba(0, 0, 0, 0.68);
}

.subtitle {
  font-family: "OnePiece", "Georgia", serif;
  font-size: clamp(0.72rem, 1.35vw, 0.82rem);
  letter-spacing: 0.1em;
  opacity: 0.88;
  margin: 0;
  align-self: center;
  text-align: center;
}

.subtitle::after {
  content: "";
  display: block;
  width: 98px;
  height: 2px;
  margin: 8px auto 0;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.92), transparent);
}

.controls {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
  width: var(--content-width);
  margin: 18px auto var(--space-2);
  padding: 7px;
  border-radius: 14px;
  background: rgba(3, 11, 22, 0.93);
  border: 1px solid rgba(173, 221, 255, 0.38);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 160ms var(--ease-smooth), box-shadow 160ms var(--ease-smooth);
}

body.keyboardOpen .controls {
  position: static !important;
}

.controls.dailyOnly {
  justify-content: flex-start;
}

.sideMenu {
  position: relative;
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.navMenu {
  position: relative;
}

.navActionBtn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ui-blue-border);
  background: linear-gradient(to bottom, var(--ui-blue-top), var(--ui-blue-bottom));
  box-shadow: none;
  color: rgba(245, 250, 255, 0.98);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.navActionBtn::before,
.panelCloseBtn::before {
  display: none;
}

.navActionBtn:hover:not(:disabled),
.navActionBtn[aria-expanded="true"] {
  background: linear-gradient(to bottom, rgba(124, 191, 246, 0.98), rgba(84, 156, 226, 0.98));
  border-color: rgba(198, 231, 255, 0.82);
  box-shadow: 0 0 14px rgba(120, 185, 245, 0.22);
  transform: translateY(-1px);
  filter: none;
}

.navIconBtn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.floatingPanel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, 86vw);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(173, 221, 255, 0.28);
  background: rgba(6, 18, 36, 0.96);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.settingsOverlay {
  position: fixed;
  inset: 0;
  z-index: 189;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.settingsPanel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(370px, 92vw);
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: calc(var(--app-vh));
  z-index: 200;
  background: rgba(3, 9, 18, 0.98);
  border-left: 1px solid rgba(173, 221, 255, 0.3);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.floatingPanel:focus-visible,
.settingsPanel:focus-visible,
.imageModal:focus-visible,
.duelPassModal:focus-visible {
  outline: 3px solid rgba(173, 221, 255, 0.9);
  outline-offset: 4px;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(173, 221, 255, 0.2);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panelCloseBtn {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(173, 221, 255, 0.32);
  background: transparent;
  color: var(--ink-muted);
  box-shadow: none;
  font-size: 1rem;
}

.panelCloseBtn:hover:not(:disabled) {
  color: var(--ink);
  border-color: rgba(198, 231, 255, 0.82);
  background: rgba(108, 176, 236, 0.12);
}

.panelBody {
  text-align: left;
}

.helpPanel {
  width: min(360px, 88vw);
}

.helpBody {
  color: rgba(244, 237, 220, 0.92);
  font-size: 0.96rem;
  line-height: 1.5;
}

.helpBody p + p {
  margin-top: 10px;
}

.settingsPanelHeader {
  padding: 20px 20px 15px;
  border-bottom: 1px solid rgba(148, 122, 70, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

.settingsCloseBtn {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 122, 70, 0.22);
  background: transparent;
  color: var(--ink-muted);
  box-shadow: none;
  font-size: 1.1rem;
}

.settingsCloseBtn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(242, 207, 116, 0.06);
}

.settingsCloseBtn::before {
  display: none;
}

.settingsPanelBody {
  padding: 20px;
  flex: 1;
}

.settingsSectionLabel {
  display: block;
  font-family: var(--font-display);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.settingsSectionLabelDisplay {
  margin-top: 20px;
}

.modeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modeCard {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(150, 207, 247, 0.42);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.16), rgba(72, 143, 214, 0.18));
  color: rgba(245, 250, 255, 0.98);
  box-shadow: none;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  -webkit-tap-highlight-color: transparent;
}

.modeCard:active:not(:disabled) {
  transform: scale(0.97);
  border-color: rgba(198, 231, 255, 0.6);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.22), rgba(72, 143, 214, 0.24));
}

.modeCard:hover:not(:disabled) {
  border-color: rgba(198, 231, 255, 0.82);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.24), rgba(72, 143, 214, 0.26));
  box-shadow: 0 0 14px rgba(120, 185, 245, 0.16);
  transform: translateY(-1px);
  filter: none;
}

.modeCard.active {
  border-color: rgba(198, 231, 255, 0.82);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.3), rgba(72, 143, 214, 0.32));
  box-shadow: 0 0 16px rgba(120, 185, 245, 0.2);
}

.modeLandingCard.active {
  border-color: rgba(240, 224, 169, 0.82);
  box-shadow:
    0 0 0 1px rgba(240, 224, 169, 0.32),
    0 16px 28px rgba(0, 0, 0, 0.24);
}

.modeCard::before {
  display: none;
}

.modeCardIcon {
  font-size: 1.2rem;
  line-height: 1;
  margin-bottom: 2px;
}

.modeCardName {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modeCardDesc {
  font-size: 0.69rem;
  color: rgba(227, 240, 252, 0.82);
  font-style: italic;
}

.displayToggleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(150, 207, 247, 0.32);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.12), rgba(72, 143, 214, 0.14));
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
}

.displayToggleRow input {
  display: none;
}

.displayToggleSwitch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(56, 104, 154, 0.9);
  border: 1px solid rgba(173, 221, 255, 0.45);
  position: relative;
  transition: background 200ms;
  flex-shrink: 0;
}

.displayToggleSwitch::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #9c8b6d;
  transition: transform 200ms var(--ease-smooth), background 200ms;
}

.displayToggleRow input:checked + .displayToggleSwitch {
  background: linear-gradient(to bottom, rgba(124, 191, 246, 0.98), rgba(84, 156, 226, 0.98));
  border-color: rgba(198, 231, 255, 0.82);
}

.displayToggleRow input:checked + .displayToggleSwitch::after {
  transform: translateX(18px);
  background: #fff;
}

.searchWrap {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.searchIcon {
  position: static;
  padding: 0 6px 0 4px;
  color: var(--gold);
  opacity: 0.7;
  pointer-events: none;
  font-size: 1rem;
}

#guessInput {
  width: 100%;
  height: 44px;
  min-height: 44px;
  font-size: 1rem;
  padding: 4px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  outline: none;
  box-shadow: none;
  caret-color: var(--gold-lt);
}

.controls:focus-within {
  border-color: rgba(173, 221, 255, 0.72);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.44), 0 0 22px rgba(120, 185, 245, 0.2);
}

#guessInput:focus {
  transform: none;
}

#guessInput::placeholder {
  color: var(--ink-faint);
}

button {
  position: relative;
  overflow: hidden;
  min-height: 44px;
  touch-action: manipulation;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid var(--ui-blue-border);
  background: linear-gradient(to bottom, var(--ui-blue-top), var(--ui-blue-bottom));
  color: rgba(245, 250, 255, 0.98);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 130ms var(--ease-smooth), box-shadow 150ms var(--ease-smooth), filter 130ms var(--ease-smooth), opacity 130ms var(--ease-smooth);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(186, 228, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 48%, transparent 66%);
  transform: translateX(-130%);
  transition: transform 380ms var(--ease-smooth);
}

button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.52);
  filter: brightness(1.05);
}

button:hover:not(:disabled)::before {
  transform: translateX(130%);
}

button:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.52), inset 0 2px 4px rgba(0, 0, 0, 0.24);
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(0.25) saturate(0.65);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

button.secondary {
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.88), rgba(72, 143, 214, 0.9));
  color: rgba(245, 250, 255, 0.98);
  border: 1px solid var(--ui-blue-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(186, 228, 255, 0.1);
}

button.secondary:hover:not(:disabled) {
  filter: none;
  background: linear-gradient(to bottom, rgba(124, 191, 246, 0.98), rgba(84, 156, 226, 0.98));
  border-color: rgba(198, 231, 255, 0.82);
  box-shadow: 0 6px 16px rgba(83, 149, 212, 0.24);
}

#newBtn {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px 15px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

button:focus,
button:focus-visible,
#guessInput:focus-visible {
  outline: 3px solid rgba(173, 221, 255, 0.9);
  outline-offset: 3px;
}

#guessInput:focus-visible {
  outline: none;
}

.msg {
  width: var(--content-width);
  max-width: var(--content-width);
  margin: var(--space-2) auto;
  min-height: 26px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 1rem;
  letter-spacing: 0.025em;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.statusCard {
  border: 1px solid rgba(148, 122, 70, 0.16);
  background: rgba(255, 255, 255, 0.016);
}

.progressPill {
  position: sticky;
  top: 12px;
  z-index: 35;
  width: fit-content;
  max-width: var(--content-width);
  margin: 0 auto 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 122, 70, 0.18);
  background: rgba(255, 255, 255, 0.028);
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.progressBar {
  position: relative;
  width: var(--content-width);
  height: 26px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 122, 70, 0.16);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.progressFill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(to right, #1a6b3c, var(--gold-lt));
  transition: width 280ms var(--ease-smooth), background 180ms var(--ease-smooth);
}

.progressLabel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
}

.recentGuesses {
  width: var(--content-width);
  margin: 0 auto 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.recentLabel {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.recentChip {
  flex: 0 0 auto;
  border: 1px solid rgba(200, 160, 50, 0.22);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 140ms var(--ease-smooth), border-color 140ms var(--ease-smooth), transform 120ms var(--ease-smooth);
}

.recentChip:hover {
  background: rgba(200, 153, 30, 0.08);
  border-color: rgba(200, 160, 50, 0.48);
  color: var(--gold-pale);
  transform: translateY(-1px);
}

#stats {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.028);
  border-color: rgba(200, 160, 50, 0.22);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.statsBar {
  width: var(--content-width);
  margin: 6px auto 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.statsBar::-webkit-scrollbar {
  display: none;
}

.statsDashboard + .controls {
  margin-top: 10px;
}

.statChip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--ui-blue-border);
  background: linear-gradient(to bottom, var(--ui-blue-top), var(--ui-blue-bottom));
  color: rgba(245, 250, 255, 0.98);
  font-family: var(--font-display);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(39, 97, 158, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.streakChip {
  color: rgba(245, 250, 255, 0.98);
  border-color: rgba(198, 231, 255, 0.82);
}

.streakChip.streakMilestone {
  border-color: var(--gold-lt);
  color: var(--gold-pale);
  box-shadow:
    0 0 0 1px rgba(232, 184, 46, 0.5),
    0 0 14px rgba(200, 153, 30, 0.5);
  animation: streakMilestonePop 3s ease-out forwards;
}

@keyframes streakMilestonePop {
  0% { transform: scale(1.25); }
  18% { transform: scale(0.95); }
  35% { transform: scale(1.08); }
  50% { transform: scale(1); }
  100% { transform: scale(1); box-shadow: none; border-color: rgba(198, 231, 255, 0.82); color: rgba(245, 250, 255, 0.98); }
}

.statsDashboard {
  width: var(--content-width);
  margin: 0 auto 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.statTile {
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.2), rgba(72, 143, 214, 0.24));
  border: 1px solid rgba(173, 221, 255, 0.42);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  transition: transform 120ms var(--ease-smooth), border-color 140ms var(--ease-smooth), background 140ms var(--ease-smooth), box-shadow 140ms var(--ease-smooth);
  box-shadow: 0 4px 12px rgba(39, 97, 158, 0.14);
  -webkit-tap-highlight-color: transparent;
}

.statTile:hover {
  transform: translateY(-1px);
  border-color: rgba(198, 231, 255, 0.82);
  background: linear-gradient(to bottom, rgba(124, 191, 246, 0.26), rgba(84, 156, 226, 0.3));
  box-shadow: 0 6px 16px rgba(39, 97, 158, 0.22);
}

.statTile:active {
  transform: scale(0.97);
  border-color: rgba(198, 231, 255, 0.7);
  background: linear-gradient(to bottom, rgba(124, 191, 246, 0.22), rgba(84, 156, 226, 0.26));
  box-shadow: 0 2px 8px rgba(39, 97, 158, 0.1);
}

.statLabel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(223, 239, 252, 0.84);
  -webkit-font-smoothing: antialiased;
}

.statValue {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 800;
  color: rgba(245, 250, 255, 0.98);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.status-info {
  color: #dbe5f4;
  background: rgba(112, 163, 221, 0.16);
  border: 1px solid rgba(112, 163, 221, 0.36);
}

.status-success {
  background: rgba(20, 100, 56, 0.2);
  border: 1px solid rgba(90, 190, 132, 0.42);
  color: #8be4ad;
  box-shadow: 0 0 0 1px rgba(112, 214, 153, 0.06), 0 10px 22px rgba(6, 26, 13, 0.28);
  animation: successFadeIn 220ms var(--ease-smooth);
}

.status-error {
  color: #ffe4e4;
  background: rgba(165, 52, 52, 0.28);
  border: 1px solid rgba(231, 121, 121, 0.36);
}

.recapCard {
  width: var(--content-width);
  margin: 8px auto 12px;
  border-radius: 14px;
  border: 1px solid rgba(173, 221, 255, 0.3);
  background: rgba(8, 16, 30, 0.84);
  padding: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.recapCard.recapWin {
  border-color: rgba(200, 153, 30, 0.65);
  box-shadow:
    0 0 0 1px rgba(232, 184, 46, 0.3),
    0 0 22px rgba(200, 153, 30, 0.28),
    0 14px 30px rgba(0, 0, 0, 0.2);
  animation: recapGoldPulse 2.4s ease-in-out infinite;
}

@keyframes recapGoldPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(232, 184, 46, 0.3), 0 0 22px rgba(200, 153, 30, 0.28), 0 14px 30px rgba(0, 0, 0, 0.2); }
  50% { box-shadow: 0 0 0 1px rgba(232, 184, 46, 0.5), 0 0 36px rgba(200, 153, 30, 0.46), 0 14px 30px rgba(0, 0, 0, 0.2); }
}

.recapTitle {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(243, 225, 168, 0.96);
  margin-bottom: 10px;
}

.recapBody {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 12px;
  align-items: center;
}

.recapImage {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(238, 200, 108, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 220, 0.18),
    0 0 0 1px rgba(10, 20, 36, 0.8);
}

.recapMeta {
  text-align: left;
}

.recapName {
  font-size: 18px;
  font-weight: 800;
  color: rgba(250, 245, 232, 0.98);
}

.recapSub {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(209, 219, 235, 0.92);
}

.recapBtn {
  min-height: 42px;
  padding: 8px 12px;
}

.boardWrap {
  position: relative;
  z-index: 1;
  width: var(--content-width);
  margin: var(--space-3) auto 0;
  padding: var(--space-2) 52px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(173, 221, 255, 0.28);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 230, 184, 0.45) rgba(255, 255, 255, 0.08);
}

.boardWrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: none;
  opacity: 0;
}

.boardWrap.victory-glow {
  animation: victoryPulse 1500ms ease-out;
  box-shadow:
    0 0 0 1px rgba(255, 226, 141, 0.45),
    0 0 36px rgba(255, 206, 90, 0.4),
    0 20px 46px rgba(0, 0, 0, 0.45);
}

.boardWrap.hardMode {
  padding-top: 44px;
  box-shadow:
    0 0 0 2px rgba(220, 75, 75, 0.45),
    0 18px 44px rgba(0, 0, 0, 0.42);
}

.boardWrap.hardMode::after {
  content: "EXTREME";
  position: absolute;
  top: 12px;
  right: 18px;
  z-index: 6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffd8d8;
  background: rgba(129, 34, 34, 0.9);
  border: 1px solid rgba(255, 142, 142, 0.45);
  border-radius: 999px;
  padding: 4px 8px;
}

.boardWrap.extremeMode::after {
  content: "EXTREME MODE";
}

.boardWrap::-webkit-scrollbar {
  height: 12px;
}

.boardWrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.boardWrap::-webkit-scrollbar-thumb {
  background: rgba(245, 230, 184, 0.45);
  border-radius: 999px;
}

.headerRow,
.headers,
.row {
  display: grid;
  grid-template-columns: repeat(8, var(--tileSize));
  gap: 10px;
  justify-content: start;
  width: max-content;
}

.headerRow,
.headers {
  margin: 0 auto var(--space-2);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 4;
  padding-top: 4px;
  padding-bottom: 4px;
  background: transparent;
}

.row {
  margin: 0 auto var(--space-3);
  position: relative;
  scroll-snap-align: start;
}

.row::before {
  content: "#" attr(data-attempt);
  position: absolute;
  left: -44px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(163, 213, 255, 0.5);
  background: linear-gradient(to bottom, #2f7fd3, #1f5da0);
  color: rgba(248, 244, 234, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.row[data-player]::after {
  content: attr(data-player);
  position: absolute;
  right: -6px;
  top: -9px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(248, 244, 234, 0.98);
  background: linear-gradient(to bottom, #2f7fd3, #1f5da0);
  border: 1px solid rgba(163, 213, 255, 0.5);
  border-radius: 999px;
  padding: 3px 7px;
}

.row.duelHiddenRow {
  display: none;
}

.headerRow > *,
.headers > * {
  width: var(--tileSize);
  height: 44px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--tileRadius);
  background: linear-gradient(to bottom, rgba(108, 176, 236, 0.95), rgba(72, 143, 214, 0.95));
  border: 1px solid rgba(173, 221, 255, 0.65);
  box-shadow: none;
  filter: none;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: rgba(245, 250, 255, 0.98);
}

.headerRow > *.hiddenHeader {
  background: rgba(18, 22, 34, 0.94);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--ink-faint);
}

#rows:empty::before {
  content: "☠";
  display: block;
  margin: 52px auto 12px;
  width: max-content;
  color: var(--ink-faint);
  font-size: 3.4rem;
  line-height: 1;
  opacity: 0.2;
  animation: skullFloat 6s ease-in-out infinite;
}

#rows:empty::after {
  content: "Search for a character to begin your hunt";
  display: block;
  margin: 0 auto var(--space-3);
  width: max-content;
  max-width: 95%;
  color: var(--ink-faint);
  font-size: 0.92rem;
  font-style: italic;
}

.tile {
  position: relative;
  width: var(--tileSize);
  height: var(--tileSize);
  border-radius: var(--tileRadius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(224, 233, 247, 0.26);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 6px 14px rgba(0, 0, 0, 0.22);
  font-size: 13px;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease-smooth), box-shadow 140ms var(--ease-smooth), border-color 140ms var(--ease-smooth);
}

.tile:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 18px rgba(0, 0, 0, 0.24);
  border-color: rgba(242, 207, 116, 0.34);
}

.tile .cellText {
  overflow: hidden;
  line-height: 1.15;
  font-size: 13px;
  white-space: normal;
  line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tile .cellArrow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  line-height: 1;
  color: rgba(242, 247, 255, 0.72);
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.35),
    0 0 16px rgba(16, 28, 48, 0.3),
    0 8px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  font-weight: 1200;
  -webkit-text-stroke: 1.1px rgba(0, 0, 0, 0.18);
  z-index: 0;
}

.tile .cellText {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.affiliationCell,
.devilFruitCell,
.hakiCell,
.originCell {
  font-size: 13px;
  line-height: 1.24;
}

.hakiCell .cellText {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  font-size: 18px;
  line-height: 1.1;
}

.tile.imageCell {
  padding: 0;
  overflow: hidden;
  position: relative;
}

.tile.imageCell .gridAvatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: inherit;
  border: 2px solid rgba(238, 200, 108, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 214, 0.2),
    0 0 0 1px rgba(10, 20, 36, 0.9);
  cursor: zoom-in;
}

.tile.imageCell.imageCell-green {
  background: #145a2f;
  border-color: rgba(98, 168, 122, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(7, 29, 15, 1),
    0 10px 20px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(90, 204, 122, 0.16);
}

.tile.imageCell.imageCell-yellow {
  background: #b98e1d;
  border-color: rgba(146, 112, 23, 0.86);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(63, 45, 3, 1),
    0 10px 20px rgba(0, 0, 0, 0.24);
}

.tile.imageCell.imageCell-red {
  background: #8f2d2d;
  border-color: rgba(126, 54, 54, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(46, 10, 10, 1),
    0 10px 20px rgba(0, 0, 0, 0.26);
}

.gridAvatar.is-fallback,
.suggestionImg.is-fallback {
  background:
    linear-gradient(150deg, rgba(31, 38, 54, 0.9), rgba(56, 68, 92, 0.92)),
    radial-gradient(circle at 65% 34%, rgba(255, 214, 122, 0.3), transparent 45%);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.green {
  background: #145a2f;
  color: #f6fff8;
  border-color: rgba(98, 168, 122, 0.78);
}

.yellow {
  background: #b98e1d;
  color: #191304;
  border-color: rgba(146, 112, 23, 0.86);
}

.red {
  background: #8f2d2d;
  color: #fff4f4;
  border-color: rgba(126, 54, 54, 0.82);
}

.grey {
  background: var(--grey);
}

.maskedCell {
  border-style: dashed;
  border-color: rgba(228, 236, 249, 0.28);
  color: rgba(236, 241, 249, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.tile.green,
.tile.yellow,
.tile.red {
  padding-top: 18px;
}

.tile.green::before,
.tile.yellow::before,
.tile.red::before {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.95;
}

.tile.green::before {
  content: "\2713";
}

.tile.yellow::before {
  content: "~";
}

.tile.red::before {
  content: "\2715";
}

.tile.green {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 0 3px rgba(7, 29, 15, 1),
    0 10px 20px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(90, 204, 122, 0.14);
}

.tile.yellow {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 0 3px rgba(63, 45, 3, 1),
    0 10px 20px rgba(0, 0, 0, 0.24);
}

.tile.red {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 0 3px rgba(46, 10, 10, 1),
    0 10px 20px rgba(0, 0, 0, 0.26);
}

.tile.green::before,
.tile.yellow::before,
.tile.red::before {
  font-weight: 800;
  line-height: 1;
}

.bountyCell .cellArrow,
.arcCell .cellArrow {
  color: rgba(26, 30, 36, 0.82);
  opacity: 0.98;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.48);
}

.tile.yellow .cellArrow {
  color: rgba(66, 40, 0, 0.6);
  text-shadow:
    0 0 8px rgba(255, 248, 220, 0.34),
    0 6px 16px rgba(56, 38, 0, 0.35);
}

.tile.yellow .cellText {
  text-shadow: none;
}

.tile.red .cellArrow,
.tile.green .cellArrow {
  color: rgba(18, 43, 24, 0.82);
}

.tile.red .cellArrow {
  color: rgba(74, 16, 16, 0.84);
}

.arcCell,
.bountyCell {
  white-space: nowrap;
}

.bountyCell {
  font-size: 11px;
}

.bountyCell .cellText {
  font-size: 11px;
  width: 100%;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.pop {
  will-change: transform, opacity, filter;
  transform-origin: center center;
  backface-visibility: hidden;
  animation: tileFlipReveal 900ms cubic-bezier(.22, .78, .18, 1);
  animation-fill-mode: both;
}

@keyframes tileFlipReveal {
  0% {
    opacity: 0;
    transform: perspective(900px) rotateX(-88deg) scale(0.94);
    filter: brightness(0.72);
  }
  48% {
    opacity: 1;
    transform: perspective(900px) rotateX(-8deg) scale(1.01);
    filter: brightness(1.06);
  }
  100% {
    opacity: 1;
    transform: perspective(900px) rotateX(0deg) scale(1);
    filter: brightness(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pop {
    animation: successFadeIn 180ms ease-out;
  }
}

@keyframes successFadeIn {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ambientDrift {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1.03);
  }
  to {
    transform: translate3d(1.5%, 1%, 0) scale(1.07);
  }
}

@keyframes victoryPulse {
  0% {
    transform: scale(1);
  }
  28% {
    transform: scale(1.006);
  }
  100% {
    transform: scale(1);
  }
}

.suggestions {
  width: var(--content-width);
  margin: 0 auto var(--space-2);
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.98);
  color: #101010;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  transition: opacity 140ms var(--ease-smooth), transform 140ms var(--ease-smooth), visibility 140ms var(--ease-smooth);
}

.suggestions::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 8px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.12), transparent);
  pointer-events: none;
  z-index: 1;
}

.suggestions.hidden {
  opacity: 0;
  transform: translateY(-4px);
  visibility: hidden;
  pointer-events: none;
  max-height: 0;
  margin-bottom: 0;
  overflow: hidden;
  border-width: 0;
  box-shadow: none;
}

.suggestionItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 120ms ease, border-color 120ms ease;
}

.suggestionItem + .suggestionItem {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.suggestionItem:hover,
.suggestionItem.active {
  background: rgba(173, 221, 255, 0.26);
}

.suggestionItem.active {
  outline: 2px solid rgba(173, 221, 255, 0.8);
  outline-offset: -2px;
  border-left-color: #6cb0ec;
}

.suggestionItem.no-match {
  cursor: default;
  color: #3f4654;
  border-left-color: transparent;
}

.suggestionImg {
  width: 56px;
  height: 56px;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  border: 2px solid rgba(212, 170, 82, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 220, 0.18),
    0 0 0 1px rgba(18, 28, 44, 0.6);
  flex: 0 0 auto;
}

.suggestionText {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
  min-width: 0;
}

.suggestionName {
  font-size: 16px;
  font-weight: 800;
  color: #171717;
}

.suggestionName mark {
  background: rgba(240, 172, 52, 0.32);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
}

.suggestionMeta {
  font-size: 12px;
  color: #3f4654;
  opacity: 0.92;
}

.factionBadge {
  margin-top: 4px;
  margin-bottom: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.faction-marines {
  color: #0e4f8c;
  background: rgba(76, 161, 238, 0.2);
  border-color: rgba(43, 126, 201, 0.42);
}

.faction-strawhat {
  color: #8a3f00;
  background: rgba(255, 176, 82, 0.25);
  border-color: rgba(212, 123, 47, 0.5);
}

.faction-yonko {
  color: #772225;
  background: rgba(231, 99, 99, 0.24);
  border-color: rgba(180, 53, 53, 0.48);
}

.faction-warlord {
  color: #5e2f83;
  background: rgba(177, 111, 221, 0.24);
  border-color: rgba(132, 76, 175, 0.5);
}

.faction-revo {
  color: #1f6b1f;
  background: rgba(131, 211, 120, 0.24);
  border-color: rgba(84, 160, 76, 0.45);
}

.faction-wano {
  color: #693612;
  background: rgba(228, 181, 109, 0.24);
  border-color: rgba(186, 132, 53, 0.45);
}

.faction-pirate,
.faction-unknown {
  color: #3c4658;
  background: rgba(138, 152, 175, 0.2);
  border-color: rgba(95, 111, 136, 0.42);
}

.boardHint {
  display: none;
  width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  margin-top: 8px;
  font-size: 0.82rem;
  color: rgba(215, 224, 237, 0.85);
  letter-spacing: 0.02em;
  text-align: center;
}

.boardHint::before {
  content: "\2194";
  margin-right: 6px;
}

.colorLegend {
  display: flex;
  align-items: center;
  gap: 6px;
  width: var(--content-width);
  margin: 6px auto 0;
  padding: 0 4px;
  flex-wrap: wrap;
}

.legendDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legendGreen { background: var(--green); }
.legendYellow { background: var(--yellow); }
.legendRed { background: var(--red); }

.legendLabel {
  font-size: 11px;
  color: rgba(215, 224, 237, 0.7);
  letter-spacing: 0.04em;
  margin-right: 8px;
}

.tile[data-tip] {
  position: relative;
}

.tile[data-tip]:hover {
  overflow: visible;
  z-index: 999;
}

.tile[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.84rem;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.12);
  pointer-events: none;
  animation: tooltipIn 120ms ease-out;
}

@keyframes tooltipIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: calc(var(--app-vh));
  pointer-events: none;
  z-index: 9999;
}

.imageModal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100svh;
  min-height: calc(var(--app-vh));
}

.imageModal img {
  max-width: min(92vw, 720px);
  max-height: min(84vh, calc(var(--app-vh) - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.imageModalClose {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 999px;
  font-size: 26px;
  line-height: 1;
}

.duelPassModal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 12, 25, 0.94);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  min-height: 100vh;
  min-height: 100svh;
  min-height: calc(var(--app-vh));
}

body.duelGateOpen .container,
body.duelGateOpen .sideMenu {
  filter: blur(16px);
  pointer-events: none;
  user-select: none;
}

body.impostorGateOpen .container,
body.impostorGateOpen .sideMenu {
  filter: blur(16px);
  pointer-events: none;
  user-select: none;
}

.duelPassCard {
  width: min(420px, 92vw);
  border-radius: 16px;
  border: 1px solid rgba(173, 221, 255, 0.34);
  background: rgba(7, 18, 35, 0.96);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  padding: 18px 16px;
  text-align: center;
}

.duelPassIcon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 14px;
  color: var(--gold-pale);
}

.duelPassCard h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.duelPassCard p {
  margin: 0 0 14px;
  color: rgba(216, 227, 244, 0.92);
  font-size: 0.92rem;
}

.impostorCard {
  width: min(460px, 92vw);
}

.impostorSetupGrid {
  display: grid;
  gap: 10px;
  margin: 14px 0 16px;
}

.impostorField {
  display: grid;
  gap: 6px;
  text-align: left;
}

.impostorField span {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(216, 227, 244, 0.8);
}

.impostorField input,
.impostorField select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(173, 221, 255, 0.3);
  background: rgba(4, 13, 27, 0.96);
  color: var(--ink);
  padding: 10px 12px;
}

.impostorSecret {
  margin: 10px 0 16px;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(2, 9, 21, 0.88);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-line;
}

.impostorSecret.impostorRole {
  border-color: rgba(220, 90, 90, 0.42);
  background: rgba(50, 12, 16, 0.9);
}

.impostorSecret.crewmateRole {
  border-color: rgba(173, 221, 255, 0.34);
  background: rgba(8, 24, 48, 0.92);
}

body.impostorMode .searchWrap,
body.impostorMode .suggestions,
body.impostorMode .statsDashboard,
body.impostorMode .boardWrap,
body.impostorMode .boardHint,
body.impostorMode .recentGuesses,
body.impostorMode .progressBar {
  display: none !important;
}

body.impostorMode .controls {
  justify-content: center;
}

body.compactMode {
  --tileSize: 92px;
}

body.compactMode .headerRow > *,
body.compactMode .headers > * {
  font-size: 0.68rem;
}

body.compactMode .tile .cellText {
  font-size: 12px;
}

body.compactMode .tile {
  font-size: 12px;
}

body.compactMode .bountyCell,
body.compactMode .bountyCell .cellText {
  font-size: 10.5px;
}

body.compactMode .tile .cellArrow {
  font-size: 52px;
}

@media (max-width: 1000px) {
  :root {
    --tileSize: 92px;
  }

  .container {
    padding-top: var(--space-4);
  }

  .boardWrap {
    width: 98vw;
    padding-left: 44px;
    padding-right: 44px;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  :root {
    --tileSize: 96px;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  :root {
    --content-width: min(980px, 95vw);
  }

  .boardWrap {
    padding-left: 46px;
    padding-right: 46px;
  }

  .row::before {
    left: -37px;
    width: 30px;
    height: 30px;
  }

  .progressPill {
    top: calc(14px + env(safe-area-inset-top));
  }
}

@media (min-width: 768px) and (max-width: 930px) {
  :root {
    --tileSize: 90px;
  }

  :root {
    --content-width: 97vw;
  }

  .boardWrap {
    padding-left: 42px;
    padding-right: 42px;
  }
}

@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {
  :root {
    --content-width: min(1060px, 94vw);
  }

}

@media (max-width: 760px) {
  :root {
    --tileSize: 84px;
  }

  .topBarInner {
    padding-left: 12px;
    padding-right: 12px;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 8px;
  }

  .brandLockup {
    align-items: flex-start;
    min-width: 0;
    flex-shrink: 1;
  }

  .brandTitleRow {
    gap: 8px;
  }

  .topBarActions {
    flex-shrink: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .subtitle {
    align-self: flex-start;
    text-align: left;
  }

  .subtitle::after {
    margin-left: 0;
    margin-right: 0;
  }

  .controls {
    position: static;
    top: auto;
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
  }

  .floatingPanel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .helpPanel,
  .menuPanel {
    width: min(90vw, 340px);
  }

  .statsDashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recapBody {
    grid-template-columns: 72px 1fr;
    gap: 10px;
  }

  .recapImage {
    width: 72px;
    height: 72px;
  }

  .recapBtn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .controls {
    gap: 10px;
  }

  .searchWrap {
    width: 100%;
  }

  .suggestions {
    width: 100%;
    margin-top: 8px;
    max-height: min(44vh, 320px);
    transform: none;
  }

  .suggestions.hidden {
    transform: none;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    border-width: 0;
    box-shadow: none;
  }

  .headerRow > *,
  .headers > * {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }

  .boardHint {
    display: inline-block;
  }

  .controls,
  .searchWrap,
  #guessInput,
  button {
    touch-action: manipulation;
  }

  #guessInput:focus {
    transform: none;
  }

  .progressPill {
    top: 72px;
    font-size: 11px;
  }

  .recentGuesses {
    gap: 6px;
    padding: 8px;
  }

  .recentChip {
    font-size: 12px;
    padding: 4px 8px;
  }

  .row::before {
    left: -31px;
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .row[data-player]::after {
    right: -2px;
    top: -8px;
    font-size: 8px;
    padding: 2px 6px;
  }

  .boardWrap {
    margin-top: 0;
    padding-left: 32px;
    padding-right: 32px;
  }

  .boardWrap.hardMode {
    padding-top: 40px;
  }

  .boardWrap.hardMode::after {
    right: 10px;
    top: 10px;
    font-size: 9px;
    padding: 4px 7px;
  }

  .tile .cellArrow {
    font-size: 50px;
  }
}

@supports (-webkit-touch-callout: none) {
  /* iOS-specific overrides */

  /* Prevent stats chips from going off-screen */
  .statsBar {
    padding-bottom: 2px; /* room for subtle overflow scrolling */
  }

  /* Force predictable 2-column grid for stats dashboard on all mobile */
  @media (max-width: 760px) {
    .statsDashboard {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
  }

  /* Improve stat tile rendering on iOS */
  .statTile {
    /* Avoid sub-pixel border flickering on iOS */
    border-width: 1px;
    /* Simpler shadow for better iOS GPU compositing */
    box-shadow: 0 2px 10px rgba(39, 97, 158, 0.16);
  }

  .statLabel {
    /* Better font rendering on iOS */
    -webkit-font-smoothing: antialiased;
  }

  .statValue {
    -webkit-font-smoothing: antialiased;
    /* Prevent number layout shift on iOS */
    font-variant-numeric: tabular-nums;
  }

  /* Tile touch feedback — hover doesn't fire on iOS */
  .tile {
    -webkit-tap-highlight-color: transparent;
  }

  /* Fix boardWrap scroll inertia on iOS */
  .boardWrap {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix suggestions scroll */
  .suggestions {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix controls sticky positioning */
  @media (max-width: 760px) {
    .controls {
      position: static;
      top: auto;
    }
  }

  /* Stat chip rendering */
  .statChip {
    /* Prevent text from being cut off on iOS due to line-height quirks */
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* Improve modal rendering on iOS */
  .settingsPanel,
  .floatingPanel {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .controls {
    position: static;
  }

  .progressPill {
    position: static;
    margin-top: 2px;
  }

  .container {
    padding-top: var(--space-3);
  }
}

@media (max-width: 430px) {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .logo-title {
    font-size: clamp(1.5rem, 7.5vw, 1.9rem);
  }

  .logoEmblem {
    font-size: 1.5rem;
  }

  .subtitle {
    display: none;
  }

  .controls {
    gap: 8px;
    padding: 10px;
  }

  #guessInput,
  #newBtn {
    height: 46px;
    min-height: 46px;
    font-size: 15px;
  }

  #newBtn {
    width: 100%;
  }

  .navActionBtn {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 0.7rem;
  }

  .boardWrap {
    padding-left: 26px;
    padding-right: 26px;
  }

  .row::before {
    left: -27px;
    width: 24px;
    height: 24px;
    font-size: 9px;
  }

  .headerRow > *,
  .headers > * {
    font-size: 0.66rem;
    letter-spacing: 0.03em;
  }

  .progressPill {
    top: calc(58px + env(safe-area-inset-top));
    font-size: 10px;
  }
}

@media (max-width: 430px) and (orientation: landscape) {
  #guessInput,
  #newBtn {
    height: 42px;
    min-height: 42px;
  }
}

@media (max-width: 390px) {
  :root {
    --tileSize: 80px;
  }

  .logo-title {
    font-size: clamp(1.72rem, 8.8vw, 2.1rem);
  }

  .controls {
    gap: 7px;
    padding: 9px;
  }

  #guessInput,
  #newBtn {
    height: 44px;
    min-height: 44px;
  }

  .boardWrap {
    padding-left: 22px;
    padding-right: 22px;
  }

  .boardWrap.hardMode {
    padding-top: 36px;
  }

  .boardWrap.hardMode::after {
    top: 8px;
    right: 8px;
    font-size: 8px;
    padding: 3px 6px;
  }

  .tile .cellArrow {
    font-size: 44px;
  }

  .statsDashboard {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .statValue {
    font-size: 14px;
  }
}

.impostorVoteBallot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 4px 0 14px;
}

.impostorVoteOption {
  width: 100%;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(173, 221, 255, 0.2);
  border-radius: 10px;
  color: #ebf2fa;
  font-size: 0.98rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.impostorVoteOption:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(173, 221, 255, 0.4);
}

.impostorVoteOption.selected {
  background: rgba(200, 153, 30, 0.22);
  border-color: var(--gold-pale);
  color: #f4d878;
  font-weight: 600;
}

.duelPassCard.impostorCardWin {
  border-color: rgba(39, 174, 96, 0.55);
  box-shadow: 0 0 0 1px rgba(39, 174, 96, 0.25);
}

.duelPassCard.impostorCardLoss {
  border-color: rgba(192, 57, 43, 0.55);
  box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.25);
}

.seoBlurb {
  width: min(680px, 100%);
  margin: 32px 0 0;
  padding-top: 24px;
  border-top: 1px solid rgba(235, 242, 250, 0.1);
}

.seoBlurbTitle {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 600;
  color: var(--gold-pale);
  letter-spacing: 0.02em;
}

.seoBlurbSubtitle {
  margin: 16px 0 6px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(235, 242, 250, 0.5);
}

.seoBlurbBody {
  margin: 0;
  color: rgba(235, 242, 250, 0.65);
  font-size: 0.92rem;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
