/* Global Styles */
:root {
  --color-bg: #F0F8FF;
  --color-text: #333333;
  --color-heading: #FF69B4;
  --color-accent: #00BFFF;
  --color-accent-hover: #009ACD;
  --color-button-text: #ffffff;
  --color-surface: #ffffff;
  --color-surface-alt: #F8FBFF;
  --color-muted: #475467;
  --color-subtle: #666666;
  --color-border: rgba(15, 23, 42, 0.08);
  --color-border-strong: #E0E0E0;
  --color-pill-border: rgba(255, 105, 180, 0.3);
  --color-pill-bg: rgba(255, 105, 180, 0.08);
  --color-pill-text: #d61f69;
  --color-topbar-link: #00BFFF;
  --color-topbar-link-hover: rgba(0, 191, 255, 0.1);
  --color-toggle-bg: #e2e8f0;
  --color-toggle-knob: #ffffff;
  --color-toggle-shadow: rgba(15, 23, 42, 0.12);
  --color-toggle-text: #0f172a;
  --color-toggle-active-text: #0f172a;
  --color-card-shadow: rgba(15, 23, 42, 0.08);
  --color-accent-soft: rgba(0, 191, 255, 0.1);
  --color-accent-soft-strong: rgba(0, 191, 255, 0.25);
  --color-success: #10B981;
  --color-success-hover: #0EA371;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-heading-hover: #e35c9b;
  --color-badge-bg: #EF4444;
  --color-badge-text: #ffffff;
  --color-badge-border: #ffffff;
}

body.theme-dark {
  --color-bg: #27374D;
  --color-text: #DDE6ED;
  --color-heading: #DDE6ED;
  --color-accent: #9DB2BF;
  --color-accent-hover: #DDE6ED;
  --color-button-text: #27374D;
  --color-surface: #526D82;
  --color-surface-alt: #526D82;
  --color-muted: #DDE6ED;
  --color-subtle: #DDE6ED;
  --color-border: rgba(221, 230, 237, 0.35);
  --color-border-strong: rgba(221, 230, 237, 0.45);
  --color-pill-border: rgba(221, 230, 237, 0.4);
  --color-pill-bg: rgba(157, 178, 191, 0.18);
  --color-pill-text: #DDE6ED;
  --color-topbar-link: #DDE6ED;
  --color-topbar-link-hover: rgba(221, 230, 237, 0.2);
  --color-toggle-bg: rgba(15, 23, 42, 0.5);
  --color-toggle-knob: #DDE6ED;
  --color-toggle-shadow: rgba(0, 0, 0, 0.25);
  --color-toggle-text: #DDE6ED;
  --color-toggle-active-text: #27374D;
  --color-card-shadow: rgba(0, 0, 0, 0.45);
  --color-accent-soft: rgba(157, 178, 191, 0.25);
  --color-accent-soft-strong: rgba(221, 230, 237, 0.4);
  --color-success: #58f0bf;
  --color-success-hover: #91ffd7;
  --color-warning: #f8ce7d;
  --color-danger: #ff7f7f;
  --color-heading-hover: #f08fc0;
  --color-badge-bg: #ff4d7c;
  --color-badge-text: #1b2430;
  --color-badge-border: #ffffff;
}
html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after {
  box-sizing: inherit;
}
body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 2rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.has-global-top-bar {
  padding-top: 5rem;
}

body.splash-active {
    overflow: hidden;
    background-color: #000;
  }

  body.splash-active > :not(#splash-screen):not(#splash-screen-2) {
    visibility: hidden;
  }

  .splash-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
  }

  .splash-screen img {
    width: clamp(180px, 50vw, 480px);
    max-width: 90vw;
    height: auto;
  }

  .splash-screen .splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
  }

  .splash-association-text {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 500;
    color: #FFFFFF;
    margin: 0;
    text-align: center;
  }

  .splash-association-image {
    width: clamp(150px, 40vw, 400px);
    max-width: 80vw;
    height: auto;
  }

  .splash-screen.splash-screen--visible {
    opacity: 1;
    visibility: visible;
  }

  .splash-screen.splash-screen--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  
  body.modal-open {
    overflow: hidden;
  }
  
h1, h2, h3 {
  font-family: 'Poppins', sans-serif;
  color: var(--color-heading);
}
  
button {
  background-color: var(--color-accent);
  color: var(--color-button-text);
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  border-radius: 4px;
  margin: 0.5rem 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

button:hover {
  background-color: var(--color-accent-hover);
}
  
.global-top-bar {
  position: fixed;
  top: 0.75rem;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 1.25rem;
  pointer-events: none;
}

.global-top-bar .top-bar-left,
.global-top-bar .top-bar-right {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.preferences-menu-wrapper {
  position: relative;
}

.preferences-menu__button {
  width: 32px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--color-card-shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.preferences-menu__button[aria-expanded="true"] {
  box-shadow: 0 6px 16px var(--color-card-shadow);
  transform: translateY(1px);
}

.preferences-menu__icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.preferences-menu__icon span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-text);
}

.preferences-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 150px;
  max-width: 200px;
  width: max-content;
  padding: 0.5rem 0.6rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 14px 30px var(--color-card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.preferences-menu[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

[data-preferences-menu][hidden] {
  display: none !important;
}

.preferences-menu__section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.preferences-menu__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preferences-menu__label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-subtle);
}

.preferences-menu__control {
  width: 100%;
}

.preferences-menu__control > * {
  width: 100%;
  max-width: 160px;
  margin: 0 auto;
}

.preferences-menu .theme-switcher,
.preferences-menu .locale-switcher {
  width: 100%;
  min-width: 0;
}

@media (max-width: 640px) {
  .preferences-menu {
    left: auto;
    right: 0;
    max-width: none;
  }
}

.global-top-bar .top-bar-left a {
  color: var(--color-topbar-link);
  text-decoration: none;
  font-weight: 600;
  padding: 0.3rem 0.1rem;
  border-radius: 6px;
  border: none;
  background: transparent;
}

.global-top-bar .top-bar-left a:hover {
  background-color: var(--color-topbar-link-hover);
}

@media (max-width: 768px) {
  body.has-global-top-bar {
    padding-top: 1.25rem;
  }

  .global-top-bar {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    padding: 0 1rem 0.65rem;
    margin-bottom: 0.75rem;
    pointer-events: auto;
  }
}


.locale-switcher {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-toggle-text);
  background: var(--color-surface);
  border-radius: 999px;
  padding: 0.18rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 6px var(--color-card-shadow);
  min-width: 82px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.locale-toggle {
  --locale-count: 2;
  --active-index: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--locale-count), minmax(0, 1fr));
  background: var(--color-toggle-bg);
  border-radius: 999px;
  min-width: 80px;
  isolation: isolate;
}

.locale-toggle::before {
  content: '';
  position: absolute;
  top: 0.12rem;
  bottom: 0.12rem;
  left: 0.12rem;
  width: calc((100% - 0.24rem) / var(--locale-count));
  border-radius: 999px;
  background: var(--color-toggle-knob);
  box-shadow: 0 6px 12px var(--color-toggle-shadow);
  transform: translateX(calc(var(--active-index) * 100%));
  transition: transform 0.25s ease;
  z-index: 0;
}

.locale-switcher--compact {
  min-width: 0;
  width: 100%;
  padding: 0.04rem;
  box-shadow: none;
  border-width: 1px;
}

.locale-toggle--compact {
  width: 100%;
  min-width: 0;
  min-height: 22px;
}

.locale-toggle--compact::before {
  top: 0.05rem;
  bottom: 0.05rem;
  left: 0.05rem;
  width: calc((100% - 0.1rem) / var(--locale-count));
}

.locale-toggle__option,
.theme-toggle__option {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: var(--color-toggle-text);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  font-family: 'Roboto', sans-serif;
  transition: color 0.2s ease;
}

.locale-switcher--compact .locale-toggle__option {
  font-size: 0.48rem;
  padding: 0.08rem 0.2rem;
  line-height: 1.05;
}

.locale-toggle__option.is-active {
  color: var(--color-toggle-active-text);
}

.theme-toggle__option.is-active {
  color: var(--color-toggle-active-text);
}

.locale-toggle__option:not(.is-active):hover,
.theme-toggle__option:not(.is-active):hover {
  background: transparent;
  color: var(--color-toggle-text);
}

.locale-toggle__option.is-active:hover,
.theme-toggle__option.is-active:hover {
  background: transparent;
  color: var(--color-button-text);
}

.theme-switcher {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-toggle-text);
  background: var(--color-surface);
  border-radius: 999px;
  padding: 0.18rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 6px var(--color-card-shadow);
  min-width: 110px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-switcher--stacked {
  width: 100%;
  justify-content: stretch;
}

.theme-toggle {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--color-toggle-bg);
  border-radius: 999px;
  min-width: 105px;
  isolation: isolate;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0.12rem;
  bottom: 0.12rem;
  left: 0.12rem;
  width: calc((100% - 0.24rem) / 2);
  border-radius: 999px;
  background: var(--color-toggle-knob);
  box-shadow: 0 6px 12px var(--color-toggle-shadow);
  transform: translateX(calc(var(--active-index, 0) * 100%));
  transition: transform 0.25s ease;
  z-index: 0;
}

.theme-switcher--stacked .theme-toggle {
  width: 100%;
}

.theme-switcher--stacked .theme-toggle__option {
  font-size: 0.65rem;
  padding: 0.3rem 0.45rem;
}

.theme-switcher--compact {
  width: 100%;
  min-width: 0;
  padding: 0.04rem;
  box-shadow: none;
  border-width: 1px;
  border-radius: 999px;
}

.theme-switcher--compact .theme-toggle {
  width: 100%;
  min-width: 0;
  min-height: 22px;
}

.theme-switcher--compact .theme-toggle::before {
  top: 0.05rem;
  bottom: 0.05rem;
  left: 0.05rem;
  width: calc((100% - 0.1rem) / 2);
}

.theme-switcher--compact .theme-toggle__option {
  font-size: 0.48rem;
  padding: 0.08rem 0.2rem;
  line-height: 1.05;
}

.theme-switcher--compact .theme-toggle__option span {
  gap: 0.06rem;
}

.theme-switcher--compact .theme-toggle__option span:first-child {
  font-size: 0.6rem;
}

.theme-switcher--compact .theme-toggle__option span:last-child {
  font-size: 0.48rem;
}

.theme-switcher--compact .theme-toggle__option span:first-child {
  font-size: 0.7rem;
}

.theme-switcher--compact .theme-toggle__option span:last-child {
  font-size: 0.55rem;
}

.theme-toggle__option span {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.locale-toggle__option:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .global-top-bar {
    padding: 0 0.5rem 0.4rem;
    margin-bottom: 0.5rem;
  }
  
  .locale-switcher {
    font-size: 0.62rem;
    padding: 0.14rem;
    min-width: 76px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  }

  .locale-toggle {
    min-width: 72px;
    padding: 0.1rem;
  }

  .locale-toggle::before {
    top: 0.1rem;
    bottom: 0.1rem;
    left: 0.1rem;
    width: calc((100% - 0.2rem) / var(--locale-count));
  }

  .locale-toggle__option {
    font-size: 0.62rem;
    padding: 0.18rem 0.4rem;
  }

  .join-inline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .join-inline-row .form-input-group,
  .join-inline-row .join-submit-group {
    width: 100%;
    flex: 1 1 auto;
  }
}
  
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }
  
input, select {
  padding: 0.5rem;
  margin: 0.5rem 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
  
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }

  /* Welcome Page Specific */
  .welcome-container {
    text-align: center;
  }

  .hero-lede {
    max-width: 720px;
    margin: 0.75rem auto 0;
    font-size: 1.15rem;
    color: var(--color-text);
  }

  .hero-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem auto 0;
  }

  .hero-tag {
    border-radius: 999px;
    border: 1px solid var(--color-pill-border);
    background: var(--color-pill-bg);
    color: var(--color-pill-text);
    padding: 0.35rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
  }

  .hero-subtext {
    max-width: 720px;
    margin: 0.5rem auto 0;
    color: var(--color-muted);
    font-size: 1rem;
  }

  .seo-feature-callout {
    margin: 2rem auto 0;
    max-width: 840px;
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 12px 30px var(--color-card-shadow);
  }

  .seo-feature-heading {
    margin: 0;
    font-size: 1.2rem;
    color: var(--color-text);
  }

  .seo-feature-subheading {
    margin: 0.25rem 0 1rem;
    color: var(--color-muted);
    font-size: 0.95rem;
  }

  .seo-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .seo-feature-list li {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.95rem;
    color: var(--color-text);
  }

  .seo-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
  }

  .streamer-proof {
    max-width: 720px;
    margin: 1.5rem auto 0;
    font-size: 0.95rem;
    color: var(--color-text);
    background: rgba(0, 191, 255, 0.08);
    border: 1px solid rgba(0, 191, 255, 0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
  }

  body.theme-dark .streamer-proof {
    background: rgba(157, 178, 191, 0.2);
    border-color: rgba(157, 178, 191, 0.35);
  }

  /* Only add left margin on desktop non-game pages */
  @media (min-width: 769px) {
    .welcome-container {
      margin-left: 3rem;
    }
  }

  /* Ensure game page has no extra margins on mobile */
  @media (max-width: 768px) {
    .game-page {
      padding: 0;
      margin: 0;
    }

    .game-page .container {
      padding: 0 1rem;
      margin: 0 auto;
    }
  }
  
  .button-group {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
  }
  
  .button-group button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
  }
  
  .rulebook-trigger {
    margin-top: 1rem;
    text-align: center;
  }

  .rulebook-trigger button {
    padding: 0.85rem 2rem;
    font-size: 1.05rem;
  }
  
  /* Host Form Specific */
  #host-form {
    text-align: center;
  }

  /* Modern Host Creation Form */
  .create-game-form {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
  }

  .form-section {
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
    overflow: visible;
  }

  .form-section:has(#timer-settings-section) {
    overflow: hidden;
  }

  .form-label {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: var(--color-heading);
    margin-bottom: 0.75rem;
  }

  .form-input,
  .form-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--color-border-strong);
    border-radius: 8px;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.3s;
  }

  .form-input:focus,
  .form-select:focus {
    outline: none;
    border-color: var(--color-accent);
  }

  .join-inline-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
  }

  .join-inline-row .join-submit-group {
    flex: 0 0 auto;
    min-width: 150px;
  }

  .join-submit-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    background-color: var(--color-accent);
    color: var(--color-button-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  .join-submit-btn:hover {
    background-color: var(--color-accent-hover);
  }

  .form-sub-label {
    display: block;
    font-size: 0.95rem;
    color: var(--color-subtle);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-family: 'Poppins', sans-serif;
  }

  .preset-detail {
    display: none;
    margin-top: 1rem;
  }

  .preset-detail .form-select {
    margin-top: 0;
  }

  .helper-text {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-subtle);
  }

  .helper-text.error {
    color: #EF4444;
  }

  .helper-text.muted {
    color: var(--color-muted);
  }

  .secondary-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: transparent;
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    color: var(--color-accent);
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: background 0.2s, color 0.2s;
  }

  .secondary-button:hover {
    background: rgba(0, 191, 255, 0.1);
  }

  .preset-secondary {
    margin-top: 1rem;
    width: 100%;
  }

  /* Mode Selector */
  .mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .mode-option {
    cursor: pointer;
    position: relative;
  }

  .mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .mode-card {
    border: 2px solid var(--color-border-strong);
    border-radius: 12px;
    padding: 1.5rem;
    background-color: var(--color-surface);
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .mode-option:hover .mode-card {
    border-color: var(--color-accent);
    box-shadow: 0 4px 8px var(--color-accent-soft-strong);
  }

  .mode-option input[type="radio"]:checked + .mode-card {
    border-color: var(--color-accent);
    background-color: var(--color-accent-soft);
    box-shadow: 0 4px 12px var(--color-accent-soft-strong);
  }

  .mode-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
  }

  .mode-description {
    font-size: 0.9rem;
    color: var(--color-subtle);
    line-height: 1.4;
  }

  /* Options Grid */
  .options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .option-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid var(--color-border-strong);
    border-radius: 8px;
    background-color: var(--color-surface);
    transition: all 0.3s;
  }

  .option-checkbox:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 6px var(--color-accent-soft-strong);
  }

  .option-checkbox input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-top: 0.25rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
  }

  .option-checkbox input[type="checkbox"]:checked ~ .checkbox-label {
    color: var(--color-accent);
  }

  .checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .checkbox-title {
    font-weight: 500;
    font-size: 1rem;
  }

  .checkbox-description {
    font-size: 0.85rem;
    color: var(--color-subtle);
    line-height: 1.3;
  }

  /* Win Conditions Modern Grid */
  .win-conditions-modern {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .win-option {
    cursor: pointer;
    position: relative;
  }

  .win-option.disabled {
    cursor: not-allowed;
  }

  .win-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .win-option.disabled .win-label {
    opacity: 0.5;
    border-color: var(--color-border);
  }

  .win-label {
    display: block;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-border-strong);
    border-radius: 8px;
    background-color: var(--color-surface);
    text-align: center;
    font-size: 0.95rem;
    transition: all 0.3s;
  }

  .win-option:hover .win-label {
    border-color: var(--color-accent);
    box-shadow: 0 2px 6px var(--color-accent-soft-strong);
  }

  .win-option input[type="checkbox"]:checked + .win-label {
    border-color: var(--color-accent);
    background-color: var(--color-accent-soft);
    font-weight: 600;
    box-shadow: 0 2px 8px var(--color-accent-soft-strong);
  }

  /* Create Button */
  .create-button {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    background-color: var(--color-accent);
    color: var(--color-button-text);
    border: none;
    border-radius: 8px;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
    cursor: default !important;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 2rem;
    isolation: isolate;
  }

  .create-button *,
  .create-button::before,
  .create-button::after {
    cursor: default !important;
    pointer-events: none;
  }

  .create-button:hover {
    background-color: var(--color-accent-hover);
    box-shadow: 0 4px 12px var(--color-accent-soft-strong);
  }

  .create-button:active {
    transform: translateY(0);
  }
  
  .win-conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
  }
  
  .win-conditions-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    text-align: center;
    font-size: 1rem;
    height: 80px; /* Consistent height */
  }
  
  .win-conditions-grid input[type="checkbox"] {
    margin-right: 0.5rem;
  }
  
  .win-conditions-grid input[type="checkbox"]:checked + span {
    font-weight: bold;
  }
  
  .win-conditions-grid label:hover {
    border-color: var(--color-accent);
  }
  
  .win-conditions-grid input[type="checkbox"]:checked ~ label {
    background-color: var(--color-accent-soft);
    border-color: var(--color-accent);
  }
  
  /* Game Header */
  .game-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    justify-content: space-between;
  }
  
  .game-header h1 {
    margin: 0;
  }
  
  /* Game Layout */
  .game-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
  }
  
  /* Card Section */
  .card-section {
    flex: 2;
    position: relative;
  }
  
  .bingo-card {
    border-collapse: separate;
    border-spacing: 0.5rem;
    margin: 1rem auto;
    width: 100%;
    max-width: 80vh;
    table-layout: fixed;
  }
  
  .bingo-card td {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
    background-color: var(--color-surface);
  }
  
  .bingo-card td::before {
    content: '';
    display: block;
    padding-bottom: 100%; /* Makes td square based on width */
  }
  
  .tile-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0.35rem;
    font-size: clamp(0.75rem, 1vw, 1.1rem);
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
    overflow: hidden;
  }

  body[data-board-size="4"] .bingo-card {
    max-width: 95vh;
  }

  body[data-board-size="4"] .tile-content {
    padding: 0.5rem;
    font-size: clamp(1rem, 1.6vw, 1.6rem);
    line-height: 1.35;
  }

  .tile-content.tile-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tile-content.tile-scroll::-webkit-scrollbar {
    width: 4px;
  }

  .tile-content.tile-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 2px;
  }
  
  /* Leaderboard Section */
  .desktop-only {
    flex: 1;
    position: sticky;
    top: 1rem;
  }
  
  #leaderboard {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-size: 0.92rem;
    table-layout: auto;
  }
  
  #leaderboard th,
  #leaderboard td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
  }
  
  #leaderboard th:first-child,
  #leaderboard td:first-child {
    white-space: nowrap;
    text-align: center;
    width: 4rem;
  }
  
  #leaderboard th {
    background-color: var(--color-accent-soft);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-accent);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

/* Truncate player names to 12 characters in desktop leaderboard */
#leaderboard td:nth-child(2) {
  max-width: 11ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaderboard td:nth-child(3),
#leaderboard td:nth-child(4) {
  text-align: center;
}

#leaderboard tbody tr:last-child td {
  border-bottom: none;
}
  
  /* Forms and Other */
  form {
    margin-bottom: 2rem;
  }
  
  /* Modal */
  .modal-content {
    text-align: center;
  }
  
  .stamped {
    background-color: #FFD700; /* Gold for stamped */
  }
  
  .selected {
    outline: 3px solid red;
    background-color: rgba(255, 0, 0, 0.2); /* Semi-transparent red background for better visibility */
  }
  
  .reroll-mode td {
    cursor: crosshair;
  }
  
  /* Bottom App Bar */
  /* Hide elements with .mobile-only by default; they'll be shown in mobile media query */
  .mobile-only {
    display: none;
  }
  
.bottom-app-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-surface-alt);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -12px 24px var(--color-card-shadow);
  padding: 0.4rem;
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
  display: none;
  gap: 0.3rem;
  z-index: 1000;
  align-items: stretch;
  border-radius: 20px 20px 0 0;
  backdrop-filter: blur(16px);
}

.bottom-app-bar__button {
  flex: 1 1 0;
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  background-color: transparent;
  color: var(--color-muted);
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
  padding: 0.55rem;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: none;
  transition: color 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(148, 163, 184, 0.28);
}

.bottom-app-bar__button:hover {
  background: transparent;
  background-color: transparent;
  color: var(--color-text);
}

.bottom-app-bar__button:active {
  background: transparent;
  background-color: transparent;
  transform: scale(0.98);
}

.bottom-app-bar__button:focus-visible {
  background: transparent;
  background-color: transparent;
  outline: 2px solid var(--color-border-strong);
  outline-offset: 2px;
}

.bottom-app-bar__button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-border);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.bottom-app-bar__button:hover::after,
.bottom-app-bar__button:focus-visible::after,
.bottom-app-bar__button:active::after {
  opacity: 1;
}

.bottom-app-bar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  font-size: 1.3rem;
  position: relative;
  z-index: 1;
}

.bottom-app-bar__icon svg {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.sidebar-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.sidebar-controls--left {
  flex: 1;
  justify-content: flex-start;
}

.sidebar-controls--right {
  flex: 1;
  justify-content: flex-end;
}

.sidebar-icon-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-icon-button__inner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  background: var(--color-surface-alt);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  position: relative;
}

.sidebar-icon-button__inner .sidebar-icon-svg {
  width: 3rem;
  height: 3rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-icon-button__inner:hover,
.sidebar-icon-button__inner:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
  color: var(--color-heading);
  outline: none;
}

.sidebar-icon-button__inner:active {
  transform: scale(0.96);
}

.sidebar-copy-confirm {
  font-size: 0.75rem;
  color: #4CAF50;
  visibility: hidden;
}

.sidebar-icon-button__inner .notification-badge {
  top: 0.15rem;
  right: 0.1rem;
}

.sidebar-icon-button {
  position: relative;
}

.sidebar-tooltip {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0);
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  white-space: nowrap;
  max-width: min(140px, 30vw);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.sidebar-icon-button:hover .sidebar-tooltip,
.sidebar-icon-button:focus-within .sidebar-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}
  
  /* Slide-up Drawer */
  .drawer {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--color-surface-alt);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -18px 30px var(--color-card-shadow);
    transition: bottom 0.3s ease;
    z-index: 999;
    padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    max-height: 80vh;
    overflow-y: auto;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
  }
  
  .drawer-content {
    margin-bottom: 2rem;
  }
  
  .close-drawer {
    display: block;
    margin: 0 auto;
  }
  
  /* Responsive Design */
  @media (max-width: 768px) {
    .game-layout {
      flex-direction: column;
    }
  
    .desktop-only {
      display: none;
    }
  
    .mobile-only {
      display: block;
    }
    /* Bottom App Bar on mobile only */
    .bottom-app-bar.mobile-only {
      display: flex;
      gap: 0.5rem;
    }

    .game-header {
      flex-direction: column;
      align-items: stretch;
      gap: 0.5rem;
      width: 100%;
    }

    .game-header h1 {
      text-align: left;
    }

    .timer-display-mobile {
      display: flex !important;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      width: 100%;
    }

    .timer-display-mobile .timer-display-info {
      align-items: center;
      gap: 0.3rem;
    }

    .timer-value {
      font-size: 0.75rem;
    }

    .game-timer-mobile .timer-value {
      font-size: 0.75rem;
    }

    .timer-controls {
      gap: 0.2rem;
      margin-top: 0;
      align-items: center;
      justify-content: flex-end;
      flex: 1 1 auto;
      min-width: 0;
    }

    .timer-controls-mobile {
      gap: 0.2rem;
      justify-content: flex-end;
      flex-wrap: wrap;
      flex: 1 1 auto;
      min-width: 0;
    }

    .timer-control-btn {
      padding: 0.2rem 0.45rem;
      font-size: 0.65rem;
    }

    .card-section {
      width: 100%;
      padding: 0;
      margin: 0 auto;
    }

    .bingo-card {
      height: auto; /* Allow natural height on mobile */
      margin: 1rem auto;
    }
  
    .bingo-card td {
      font-size: inherit;
    }
  
    .tile-content {
      font-size: clamp(0.65rem, 3vw, 0.95rem);
      padding: 0.3rem;
    }
    /* Mobile-friendly home page tweaks */
    .welcome-container h1 {
      font-size: 6vw;
      margin-bottom: 1rem;
    }
    .welcome-container h2 {
      font-size: 5vw;
      margin-bottom: 1rem;
    }
    .button-group button {
      font-size: 4vw;
      padding: 1rem 0.5rem;
      margin: 0.5rem 0;
    }
    form input, form select {
      width: 100%;
      font-size: 4vw;
      padding: 1rem;
    }
    .win-conditions-grid {
      grid-template-columns: 1fr !important;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }
    .win-conditions-grid label {
      font-size: 4vw;
      padding: 0.75rem;
      height: auto;
      display: block;
    }

    /* Mobile styles for modern form */
    .mode-selector {
      grid-template-columns: 1fr;
    }

    .mode-card {
      padding: 1rem;
    }

    .mode-title {
      font-size: 1rem;
    }

    .mode-description {
      font-size: 0.85rem;
    }

    .options-grid {
      grid-template-columns: 1fr;
    }

    .win-conditions-modern {
      grid-template-columns: repeat(2, 1fr);
      gap: 0.5rem;
    }

    .win-label {
      font-size: 0.85rem;
      padding: 0.6rem 0.75rem;
    }

    .form-label {
      font-size: 1rem;
    }

    .create-button {
      font-size: 1rem;
      padding: 0.85rem 1.5rem;
    }
  }

/* Mobile drawer leaderboard styles */
@media (max-width: 768px) {
  #drawer-leaderboard {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
    margin-bottom: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--color-card-shadow);
    overflow: hidden;
  }
  #drawer-leaderboard th,
  #drawer-leaderboard td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
  }
  #drawer-leaderboard th {
    background-color: var(--color-accent-soft);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-accent);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  #drawer-leaderboard td:nth-child(2) {
    max-width: 11ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #drawer-leaderboard tbody tr:last-child td {
    border-bottom: none;
  }
}

/* Winner modal overlay */
#winner-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
/* Winner modal content */
#winner-modal > div {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 90%;
  margin: 0 auto;
}
#winner-modal button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
}

/* Copy code button wrapper */
.copy-code-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Chat panel */
#chat-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 360px;
  height: 100%;
  background: var(--color-surface);
  box-shadow: -2px 0 5px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease, bottom 0.3s ease;
  z-index: 1002;
}
#chat-panel.open {
  right: 0;
}
@media (max-width: 768px) {
  #chat-panel {
    top: auto;
    right: 0;
    bottom: -50%;
    width: 100%;
    height: 50%;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }
  #chat-panel.open {
    bottom: 0;
  }
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #ccc;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-row {
  display: flex;
  width: 100%;
}
.chat-row.self {
  justify-content: flex-end;
}
.chat-row.other {
  justify-content: flex-start;
}
.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--color-border-strong);
}
.chat-input input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 0.5rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  background-color: var(--color-surface);
  color: var(--color-text);
}
.chat-input button {
  background-color: var(--color-accent);
  color: var(--color-button-text);
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
}
.chat-bubble {
  max-width: 70%;
  padding: 0.5rem 1rem;
  border-radius: 16px;
  color: #fff;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  margin: 0;
}

/* Chat bubble sub-elements */
.chat-bubble .bubble-header {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
  font-weight: bold;
}

.chat-bubble .bubble-content {
  white-space: pre-wrap;
}

.chat-bubble .bubble-time {
  font-size: 0.6rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  align-self: flex-end;
}
.chat-row.self .chat-bubble {
  border-bottom-right-radius: 2px;
  color: #fff;
}
.chat-row.other .chat-bubble {
  border-bottom-left-radius: 2px;
  color: #111;
}
.notification-badge {
  position: absolute;
  top: 0.9rem;
  right: 0.6rem;
  min-width: 18px;
  height: 18px;
  padding: 0 0.15rem;
  border-radius: 999px;
  background-color: var(--color-badge-bg, var(--color-danger, #EF4444));
  color: var(--color-badge-text, #fff);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  border: 2px solid var(--color-badge-border, #fff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.bottom-app-bar__button .notification-badge {
  top: auto;
  right: auto;
}

.bottom-app-bar__icon .notification-badge {
  top: -0.3rem;
  right: -0.45rem;
}

.notification-badge:not(.is-visible) {
  display: none;
}

/* Chat toggle button */
.chat-toggle-button {
  background-color: var(--color-accent);
  color: var(--color-button-text);
  border: none;
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-toggle-button svg {
  width: 1rem;
  height: 1rem;
}
.chat-toggle-button:hover {
  background-color: var(--color-accent-hover);
}
.chat-icon-wrapper {
  display: flex;
  align-items: flex-start;
}

/* Hide desktop chat icon on mobile */
@media (max-width: 768px) {
  .chat-icon-wrapper {
    display: none !important;
  }
}

/* Custom cursor for own card; hotspot is slightly above bottom center */
.own-card {
  cursor: url('/images/hanko-cursor.png') 32 58, auto;
}
.own-card td:not(.stamped),
.own-card td:not(.stamped) .tile-content {
  cursor: inherit;
}

/* Custom cursor for VS mode cards */
.vs-card {
  cursor: url('/images/hanko-cursor.png') 32 58, auto;
}
.vs-card td,
.vs-card td .tile-content {
  cursor: inherit;
}

/* Hanko stamp overlay for own card: centered with tile content */
.own-card td.stamped {
  background-color: transparent !important;
  cursor: default !important;
}
.own-card td.stamped .tile-content::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  background-image: url('/images/tcb_stamp.png');
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.3;
  pointer-events: none;
}

/* VS Mode colored stamp overlays */
.vs-card td.stamped-RED {
  background-color: rgba(255, 0, 0, 0.4) !important;
}
.vs-card td.stamped-BLUE {
  background-color: rgba(0, 0, 255, 0.4) !important;
}
.vs-card td.stamped-GREEN {
  background-color: rgba(0, 255, 0, 0.4) !important;
}
.vs-card td.stamped-YELLOW {
  background-color: rgba(255, 255, 0, 0.4) !important;
}
.vs-card td.stamped-PURPLE {
  background-color: rgba(128, 0, 128, 0.4) !important;
}
.vs-card td.stamped-ORANGE {
  background-color: rgba(255, 165, 0, 0.4) !important;
}
.vs-card td.stamped-PINK {
  background-color: rgba(255, 192, 203, 0.4) !important;
}
.vs-card td.stamped-CYAN {
  background-color: rgba(0, 255, 255, 0.4) !important;
}

/* VS Mode stamp image overlay */
.vs-card td[class*="stamped-"] .tile-content::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  background-image: url('/images/tcb_stamp.png');
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.3;
  pointer-events: none;
}

/* Color badges for leaderboard */
.color-badge {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.color-badge.RED { background-color: rgba(255, 0, 0, 0.8); }
.color-badge.BLUE { background-color: rgba(0, 0, 255, 0.8); }
.color-badge.GREEN { background-color: rgba(0, 255, 0, 0.8); }
.color-badge.YELLOW { background-color: rgba(255, 255, 0, 0.8); }
.color-badge.PURPLE { background-color: rgba(128, 0, 128, 0.8); }
.color-badge.ORANGE { background-color: rgba(255, 165, 0, 0.8); }
.color-badge.PINK { background-color: rgba(255, 192, 203, 0.8); }
.color-badge.CYAN { background-color: rgba(0, 255, 255, 0.8); }

/* VS Mode Card Cover */
.card-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  border-radius: 8px;
}
.card-cover-overlay .cover-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}
.card-cover-overlay .cover-text {
  color: var(--color-text);
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  padding: 0 1rem;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.card-cover-overlay .cover-subtext {
  color: var(--color-subtle);
  font-size: 1rem;
  margin-top: 0.5rem;
  text-align: center;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.card-cover-overlay.hidden {
  display: none;
}

/* Card cover mobile responsive */
@media (max-width: 768px) {
  .card-cover-overlay .cover-icon {
    font-size: 3rem;
  }
  .card-cover-overlay .cover-text {
    font-size: 1.2rem;
  }
  .card-cover-overlay .cover-subtext {
    font-size: 0.875rem;
  }
}

/* Hanko press animation */
@keyframes hanko-press {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.hanko-press {
  position: absolute;
  background: url('/images/hanko.png') center center / contain no-repeat;
  pointer-events: none;
  animation: hanko-press 0.3s ease-out forwards;
  transform-origin: center center;
}

/* Hide cursor during animation on own card */
.own-card.no-cursor td {
  cursor: none !important;
}

/* Timer Display */
.timer-display-section {
  padding: 0.5rem 0;
  border-bottom: 1px solid #E0E0E0;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.timer-display-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 1 auto;
  min-width: 0;
}

.game-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  min-width: 100px;
  max-width: 120px;
}

.game-timer.timer-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation: pulse-warning 2s infinite;
}

.game-timer.timer-danger {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  animation: pulse-danger 1s infinite;
}

@keyframes pulse-warning {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3); }
  50% { transform: scale(1.02); box-shadow: 0 6px 16px rgba(240, 147, 251, 0.5); }
}

@keyframes pulse-danger {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px rgba(250, 112, 154, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 8px 20px rgba(250, 112, 154, 0.7); }
}

.timer-value {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.05em;
}

.timer-display-mobile {
  margin: 0.5rem 0 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.game-timer-mobile {
  padding: 0;
  min-width: 90px;
}

.game-timer-mobile .timer-value {
  font-size: 0.85rem;
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  flex-wrap: wrap;
  flex: 1 1 0;
  min-width: 120px;
  margin-top: 0;
}

.timer-controls-desktop {
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}

.timer-controls-mobile {
  justify-content: flex-end;
  gap: 0.2rem;
  flex: 1 1 auto;
}

.timer-control-btn {
  padding: 0.28rem 0.55rem;
  border: none;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Roboto', sans-serif;
  white-space: nowrap;
}

.timer-start-btn {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
}

.timer-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.timer-pause-btn {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white;
}

.timer-pause-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.timer-resume-btn {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: white;
}

.timer-resume-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.timer-reset-btn {
  background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
  color: white;
}

.timer-reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

.timer-control-btn:active {
  transform: translateY(0);
}

/* Left sidebar styling */
.sidebar {
  width: 22rem;
  max-width: 22rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  box-shadow: 2px 0 5px var(--color-card-shadow);
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

/* Sidebar header: copy code and chat toggle */
.sidebar-header {
  display: flex;
  justify-content: space-between;
}

.sidebar-preferences {
  margin: 0.75rem 0 1rem;
}

.sidebar-preferences .theme-switcher {
  width: 100%;
}

/* Leaderboard takes available space */
.leaderboard-section {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.leaderboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  filter: drop-shadow(0 10px 30px var(--color-card-shadow));
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Reroll section sticks to bottom */
.reroll-section {
  margin-top: auto;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    align-items: flex-end;
    gap: 1rem;
}

/* Reroll controls wrapper styling */
.reroll-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reroll-controls button {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
  min-width: 140px;
  text-align: center;
}

/* Host Streamer Mode Buttons */
.host-streamer-section {
  margin-top: auto;
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.host-streamer-section button {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
  min-width: 140px;
  text-align: center;
}

/* Non-Host Streamer Mode Button */
.nonhost-streamer-section {
  margin-top: auto;
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.nonhost-streamer-section button {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
  min-width: 140px;
  text-align: center;
}

/* Streamer Mode Overrides */
body.streamer-mode {
  background: none !important;
  background-color: transparent !important;
}
body.streamer-mode::before,
body.streamer-mode::after {
  display: none !important;
}
html:has(body.streamer-mode) {
  background: none !important;
  background-color: transparent !important;
}
body.streamer-mode .bingo-card td {
  background-color: var(--color-surface) !important;
}
/* VS Mode colored stamps in streamer mode - semi-transparent color on opaque white */
body.streamer-mode .vs-card td.stamped-RED {
  background: linear-gradient(rgba(255, 0, 0, 0.4), rgba(255, 0, 0, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-BLUE {
  background: linear-gradient(rgba(0, 0, 255, 0.4), rgba(0, 0, 255, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-GREEN {
  background: linear-gradient(rgba(0, 255, 0, 0.4), rgba(0, 255, 0, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-YELLOW {
  background: linear-gradient(rgba(255, 255, 0, 0.4), rgba(255, 255, 0, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-PURPLE {
  background: linear-gradient(rgba(128, 0, 128, 0.4), rgba(128, 0, 128, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-ORANGE {
  background: linear-gradient(rgba(255, 165, 0, 0.4), rgba(255, 165, 0, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-PINK {
  background: linear-gradient(rgba(255, 192, 203, 0.4), rgba(255, 192, 203, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .vs-card td.stamped-CYAN {
  background: linear-gradient(rgba(0, 255, 255, 0.4), rgba(0, 255, 255, 0.4)), var(--color-surface) !important;
}
body.streamer-mode .card-cover-overlay {
  background-color: var(--color-surface) !important;
}
body.streamer-mode .game-header h1 {
  display: none !important;
}

/* Minimal Mode - Hide UI elements, show only card */
body.minimal-mode .sidebar {
  display: none !important;
}
body.minimal-mode .bottom-app-bar {
  display: none !important;
}
body.minimal-mode .game-header {
  display: none !important;
}
body.minimal-mode .container {
  margin: 0 !important;
  padding: 0 !important;
}
body.minimal-mode.game-page {
  margin-left: 0 !important;
  padding: 0 !important;
}
body.minimal-mode .hamburger-menu-container {
  display: none !important;
}
.minimal-exit-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 999px;
  background-color: var(--color-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.minimal-exit-btn:hover,
.minimal-exit-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.minimal-exit-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}
body.minimal-mode .minimal-exit-btn {
  display: inline-flex;
}

/* Hamburger Menu Styling */
.hamburger-menu-container {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 1000;
}

.hamburger-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--color-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s, transform 0.2s;
}

.hamburger-toggle:hover {
  background-color: var(--color-accent-hover);
  transform: scale(1.05);
}

.hamburger-icon {
  font-size: 1.5rem;
  color: var(--color-button-text);
  line-height: 1;
}

.hamburger-menu {
  position: absolute;
  bottom: 60px;
  left: 0;
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--color-card-shadow);
  min-width: 200px;
  max-width: 300px;
  z-index: 999;
}

.hamburger-menu-content {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hamburger-preferences {
  margin-bottom: 0.5rem;
}

.hamburger-preferences .theme-switcher {
  width: 100%;
}

.hamburger-menu-content button {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
  text-align: left;
  width: 100%;
}

.hamburger-menu-content select {
  font-size: 0.875rem;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--color-border-strong);
  width: 100%;
}

.hamburger-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0.25rem 0;
}

.hamburger-menu-content [id^="reroll-mode-"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.hamburger-menu-content p {
  font-size: 0.8rem;
  margin: 0;
  color: var(--color-subtle);
}

/* Hide on mobile - use bottom app bar instead */
@media (max-width: 768px) {
  .hamburger-menu-container {
    display: none;
  }
}
/* Hide streamer toggle in reroll mode */
.reroll-section.reroll-active #streamer-toggle-btn {
  display: none !important;
}
/* Hide sidebar on mobile */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
}

/* Shift content right on desktop */
@media (min-width: 769px) {
  .game-page {
    margin-left: 22rem; /* Match sidebar max-width */
    display: flex;
    justify-content: center;
    padding: 0;
  }

  .game-page .container {
    width: 100%;
    padding: 0 2rem;
  }
}

/* Mobile centered toast above bottom navbar */
#copy-toast-mobile {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 64px; /* above bottom app bar height */
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  z-index: 1001;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
@media (max-width: 768px) {
  #copy-toast-mobile {
    display: none; /* default hidden; we toggle inline via JS */
  }
}

/* Polished modal styles */
.modal-overlay {
  display: none; /* toggled via JS */
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1003;
  padding: 1rem;
  display: none; /* ensure hidden until shown */
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--color-surface);
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--color-card-shadow);
  padding: 1.25rem 1.25rem 1rem;
}
.modal-card--status {
  text-align: center;
}
.modal-card--report {
  max-width: 500px;
}
.modal-card--player {
  width: min(90%, 900px);
  max-width: 900px;
  position: relative;
}
.modal-card--instructions {
  max-width: 640px;
}
.modal-card--device-link {
  max-width: min(560px, calc(100vw - 1rem));
  max-height: 90vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
}
.modal-card--device-link .device-link-scroll {
  overflow-y: auto;
  padding-right: 0.25rem;
  flex: 1;
}
.rulebook-modal-card {
  max-height: 90vh;
  overflow-y: auto;
}
.rulebook-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.rulebook-section {
  text-align: left;
}
.rulebook-section-title {
  margin: 0 0 0.5rem 0;
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  color: var(--color-heading);
}
.rulebook-list {
  margin: 0.5rem 0 0 1rem;
  padding: 0;
}
.rulebook-list li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
  list-style-type: disc;
}
.rulebook-list li strong {
  color: var(--color-text);
}
.modal-ordered-list {
  margin: 0.75rem 0 1.25rem 1.25rem;
  padding: 0;
  line-height: 1.6;
}
.modal-ordered-list li {
  margin-bottom: 0.5rem;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  margin: 0;
}
.modal-title--xl {
  font-size: 2rem;
}
.modal-title--success {
  color: var(--color-success);
}
.modal-title--warning {
  color: var(--color-warning);
}
.modal-title--danger {
  color: var(--color-danger);
}
.modal-subtitle {
  color: var(--color-subtle);
  margin: 0.25rem 0 1rem 0;
  font-size: 0.95rem;
}
.modal-subtitle--strong {
  color: var(--color-text);
  font-size: 1.1rem;
}
.modal-subtitle--muted {
  color: var(--color-subtle);
}
.modal-subtitle--success {
  color: var(--color-success);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.modal-actions--wrap {
  flex-wrap: wrap;
}
.device-link-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.device-link-field {
  background: var(--color-surface-alt);
  border-radius: 12px;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
}
.device-link-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.25rem;
}
.device-link-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.65rem;
  letter-spacing: 0.25rem;
  color: var(--color-heading);
  text-transform: uppercase;
}
.device-link-pin {
  letter-spacing: 0.4rem;
}
.device-link-share {
  margin: 1rem 0;
}
.device-link-share-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
  display: block;
}
.device-link-share-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.device-link-share-row input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: var(--color-surface-alt);
  color: var(--color-text);
}
.device-link-share-row button {
  white-space: nowrap;
}
.device-link-qr-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  background: var(--color-surface-alt);
  border-radius: 12px;
  border: 1px dashed var(--color-border);
  margin-bottom: 0.75rem;
  position: relative;
}
.device-link-qr-wrapper img {
  max-width: 180px;
  width: 100%;
  height: auto;
  display: none;
}
.device-link-placeholder {
  font-size: 0.95rem;
  color: var(--color-muted);
  text-align: center;
  padding: 0 1rem;
}
.device-link-expiry {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0.5rem 0 0;
}
.modal-error {
  color: var(--color-danger);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  min-height: 1.2rem;
}
.device-link-note {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0.5rem 0;
}
.device-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.device-link-status {
  font-size: 0.9rem;
  color: var(--color-muted);
  min-height: 1.2rem;
}
.device-link-warning {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  z-index: 10;
  padding: 1rem;
}
.device-link-warning-card {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.device-link-warning-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--color-heading);
}
.device-link-warning-card p {
  margin-bottom: 1rem;
  color: var(--color-text);
}
.device-link-warning-button {
  background: var(--color-danger);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 999px;
}
.device-link-warning-button:hover {
  background: #c53030;
}

@media (max-width: 600px) {
  .modal-card--device-link {
    padding: 0.75rem 0.85rem;
    max-width: calc(100vw - 0.5rem);
  }
  .device-link-value {
    font-size: 1.25rem;
    letter-spacing: 0.12rem;
  }
  .device-link-qr-wrapper {
    min-height: 150px;
  }
  .device-link-share-row {
    flex-direction: column;
    align-items: stretch;
  }
  .device-link-share-row button {
    width: 100%;
  }
}

/* Device link landing page */
.link-page {
  min-height: 100vh;
  margin: 0;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}
.link-page__container {
  width: 100%;
  max-width: 480px;
}
.link-card {
  background: var(--color-surface);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  border: 1px solid var(--color-border);
}
.link-card__header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.link-card__icon {
  font-size: 2.25rem;
}
.link-card__subtitle {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
}
.link-alert {
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}
.link-alert--error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}
.link-alert--info {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}
.link-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.link-form__label {
  font-weight: 500;
  color: var(--color-text);
}
.link-form__input {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  text-transform: uppercase;
}
.link-form__input#link-pin {
  text-transform: none;
}
.link-form__submit {
  margin-top: 0.5rem;
  padding: 0.85rem;
  font-size: 1rem;
}
.link-card__footnote,
.link-card__helper {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}
.link-card__back {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}
.link-card__back:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .link-card {
    padding: 1.25rem;
  }
}
.modal-footer {
  margin-top: 0.75rem;
  text-align: center;
}
.modal-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.modal-overlay--scroll {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding-top: 3rem;
  padding-bottom: 3rem;
}
.modal-close-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  color: var(--color-subtle);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close-button:hover {
  color: var(--color-text);
}
.modal-field {
  margin-bottom: 1rem;
}
.modal-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}
.modal-field textarea,
.modal-field input,
.modal-field select {
  width: 100%;
  border: 2px solid var(--color-border-strong);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: 'Roboto', sans-serif;
}
.modal-button-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.modal-captcha-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.modal-captcha-question {
  font-weight: 600;
  color: var(--color-heading);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-family: 'Roboto', sans-serif;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary { background-color: var(--color-success); color: #fff; }
.btn-primary:hover { background-color: var(--color-success-hover); }
.btn-danger { background-color: var(--color-danger); color: #fff; }
.btn-danger:hover { background-color: #DC2626; }
.btn-secondary { background-color: #E5E7EB; color: #111827; }
.btn-secondary:hover { background-color: #D1D5DB; }
.btn-accent { background-color: var(--color-accent); color: var(--color-button-text); }
.btn-accent:hover { background-color: var(--color-accent-hover); }
.btn-heading { background-color: var(--color-heading); color: #fff; }
.btn-heading:hover { background-color: var(--color-heading-hover); }
.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 0.75rem;
}

/* Badges */
.badges {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.badge {
  background: #F3F4F6;
  color: #374151;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}
.badge.success { background: #ECFDF5; color: #065F46; }
.badge.error { background: #FEF2F2; color: #991B1B; }

/* Vote result list */
.vote-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}
.vote-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}
.vote-list li:last-child { border-bottom: none; }
.vote-pill {
  border-radius: 9999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
}
.vote-yes { background: #ECFDF5; color: #065F46; }
.vote-no { background: #FEF2F2; color: #991B1B; }

/* Select input spacing */
.modal-card select {
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.5rem;
}
