@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;700&family=Sora:wght@400;600;700;800&display=swap");

:root {
  --blue-strong: #2462c7;
  --blue-soft: #7bd5ff;
  --red-strong: #cf3d30;
  --red-soft: #ff9c82;
  --ink: #1f1a16;
  --paper: #efe2cc;
  --wood-1: #d7a268;
  --wood-2: #ba7c43;
  --wood-3: #8b5529;
  --panel: #f8f2e8;
  --glass: #fff9efc9;
  --chat-shell: #fff6eadf;
  --chat-line: #2f2118;
  --focus: #172f63;
  --panel-edge: #1f1a16;
  --accent-gold: #ffbf53;
  --danger: #cc2f24;
  --font-heading: "Chakra Petch", "Trebuchet MS", sans-serif;
  --font-body: "Sora", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 8%, #fff7df 0%, transparent 45%),
    radial-gradient(circle at 88% 8%, #ffe4dd 0%, transparent 42%),
    radial-gradient(circle at 50% -20%, #fff8e0, #efe2cc 62%),
    linear-gradient(180deg, #efe2cc, #e7d2b4);
  background-size: 140% 140%, 160% 160%, 100% 100%, 100% 100%;
  color: var(--ink);
  overflow: hidden;
  line-height: 1.35;
  animation: ambient-drift 22s ease-in-out infinite alternate;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  animation: shell-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.arena {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 10px solid #f9efdf;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px #00000014, 0 10px 30px #0000001e;
}

.side {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8rem 4vw 13rem;
  overflow: hidden;
}

.side::before,
.side::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.side::before {
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 14% 18%, #ffffffaa 0 3px, transparent 4px),
    radial-gradient(circle at 72% 22%, #ffffff7f 0 2px, transparent 3px),
    radial-gradient(circle at 84% 64%, #ffffff99 0 2px, transparent 3px),
    radial-gradient(circle at 26% 76%, #ffffff88 0 4px, transparent 5px),
    radial-gradient(circle at 6% 56%, #ffffff7f 0 2px, transparent 3px);
  animation: side-shimmer 9s linear infinite;
}

.side::after {
  opacity: 0.23;
  background-image:
    radial-gradient(circle at 18% 78%, transparent 0 48px, #00000014 50px 54px, transparent 56px),
    radial-gradient(circle at 68% 88%, transparent 0 52px, #00000014 54px 58px, transparent 60px),
    radial-gradient(circle at 86% 16%, transparent 0 42px, #00000014 44px 48px, transparent 50px);
}

.side-blue {
  background:
    radial-gradient(circle at 22% 20%, #ffffff7f 0 20%, transparent 30%),
    linear-gradient(154deg, #2a63c2 0%, #58a6ec 52%, #ace6ff 100%);
}

.side-red {
  background:
    radial-gradient(circle at 74% 18%, #ffffff73 0 20%, transparent 30%),
    linear-gradient(210deg, #c7362e 0%, #e96f58 52%, #ffbea8 100%);
}

.candidate-card {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 420px;
  width: 100%;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  background:
    linear-gradient(180deg, #ffffff52, #ffffff1c),
    radial-gradient(circle at 80% 8%, #ffffffa6 0 18%, transparent 26%);
  border: 2px solid #ffffff78;
  border-radius: 22px;
  padding: 1.2rem 1rem 1.4rem;
  backdrop-filter: blur(5px);
  box-shadow: 0 14px 32px #0000002b, inset 0 0 0 1px #ffffff72;
  animation: card-bob 6.5s ease-in-out infinite;
}

.side-red .candidate-card {
  animation-delay: -3.2s;
}

.candidate-label {
  margin: 0;
  font-size: clamp(1.45rem, 3.2vw, 2.15rem);
  letter-spacing: 0.06em;
  font-weight: 900;
  font-family: var(--font-heading);
  text-shadow: 2px 2px 0 #ffffffb5;
}

.candidate-name {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 900;
  font-family: var(--font-heading);
  text-shadow: 2px 2px 0 #ffffffb5;
}

.vote-btn {
  width: min(280px, 86%);
  min-height: 86px;
  border-radius: 999px;
  border: 4px solid #2a1d13;
  box-shadow: inset 0 12px 18px #ffffffab, inset 0 -8px 14px #0000002b, 0 14px 0 #0000002f, 0 20px 34px #0000002a;
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fffbe9;
  text-shadow: 2px 2px 0 #2a1d13;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease, box-shadow 0.2s ease;
  animation: vote-glow 2.8s ease-in-out infinite;
}

.vote-btn span {
  display: inline-block;
  animation: vote-text-bob 2.8s ease-in-out infinite;
}

.vote-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.12);
}

.vote-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 7px 14px #ffffff8e, inset 0 -6px 12px #00000033, 0 8px 0 #00000034;
}

.vote-btn-blue {
  background: linear-gradient(180deg, #b9ecff 0%, #7ad7ff 45%, #4dacef 100%);
}

.vote-btn-red {
  background: linear-gradient(180deg, #ffc3b7 0%, #ff8f79 45%, #e35848 100%);
}

.vote-btn.disabled,
.vote-btn:disabled {
  background: linear-gradient(180deg, #d3d3d3 0%, #a7a7a7 100%);
  color: #f2f2f2;
  text-shadow: none;
  border-color: #535353;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: inset 0 6px 10px #ffffff59, inset 0 -4px 10px #0000002f, 0 6px 0 #0000002f;
}

.tug-header {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 4rem));
  z-index: 10;
  text-align: center;
  background: #fff6e3c2;
  border: 2px solid #21150f;
  border-radius: 20px;
  padding: 0.55rem 0.75rem 0.75rem;
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 24px #00000028;
  overflow: hidden;
  animation: header-drop 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.tug-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, #ffffff8d 45%, transparent 65%);
  transform: translateX(-120%);
  animation: header-sheen 6s linear infinite;
  pointer-events: none;
}

.tug-track {
  position: relative;
  height: 72px;
  border-radius: 999px;
  border: 5px solid #1f1a16;
  overflow: hidden;
  background: #f4e9d6;
  box-shadow: inset 0 0 0 3px #ffffff77, 0 7px 0 #0000002b;
}

.fill {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: width 0.45s ease;
}

.fill-blue {
  left: 0;
  width: 50%;
  background: linear-gradient(90deg, #2e5fc5 0%, #5da8ef 40%, #90dfff 100%);
}

.fill-red {
  right: 0;
  width: 50%;
  background: linear-gradient(270deg, #c4332b 0%, #e36a51 45%, #ffae99 100%);
}

.tug-handle {
  position: absolute;
  top: 6px;
  left: calc(50% - 14px);
  width: 28px;
  height: 60px;
  border-radius: 16px;
  border: 3px solid #2d2018;
  background: linear-gradient(180deg, #fff4de 0%, #e8d7c2 100%);
  box-shadow: 0 2px 8px #00000040;
  transition: left 0.45s ease;
}

.tug-stars {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(0.75rem, 2vw, 1.2rem);
  letter-spacing: 1.1rem;
  color: #fff8;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 0 0 8px #ffffff80;
}

.ratio-text {
  margin: 0.45rem 0 0;
  font-size: clamp(1.6rem, 3.3vw, 2.4rem);
  font-weight: 900;
  font-family: var(--font-heading);
  text-shadow: 2px 2px 0 #ffffffb5;
}

.total-votes-text {
  margin: 0.2rem 0 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 800;
  color: #2b2018;
}

.milestone-progress-text {
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #5a4434;
}

.ballot-wrap {
  position: absolute;
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%);
  width: min(320px, 44vw);
  height: 390px;
  z-index: 8;
  pointer-events: none;
}

.ballot-lid {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 118px;
  border-radius: 22px 22px 12px 12px;
  border: 4px solid #4b2b17;
  background: linear-gradient(170deg, #e7b77c 0%, #c58a4e 58%, #965c2e 100%);
  box-shadow: 0 8px 0 #00000026;
}

.ballot-slot {
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%);
  width: 38%;
  height: 16px;
  border-radius: 12px;
  border: 3px solid #3a2617;
  background: linear-gradient(180deg, #2b1c10, #120d07);
  z-index: 2;
}

.ballot-slot.token-hit {
  box-shadow: 0 0 18px #ffffff99, 0 0 26px #ffde80a6;
}

.slot-seal {
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%) scaleX(0.08);
  transform-origin: center;
  width: 38%;
  height: 16px;
  border-radius: 12px;
  border: 2px solid #9ea4ab;
  background:
    linear-gradient(90deg, #717984 0%, #d8dde3 35%, #8f98a3 67%, #676f79 100%);
  box-shadow: inset 0 0 0 1px #eef2f6aa, 0 0 10px #ffffff4f;
  opacity: 0;
  z-index: 3;
  transition: transform 0.9s ease, opacity 0.45s ease;
}

body.voting-ended .slot-seal {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.ballot-box {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 84%;
  height: 290px;
  border: 4px solid #4a2c19;
  border-top-width: 6px;
  border-radius: 12px 12px 6px 6px;
  background:
    repeating-linear-gradient(90deg, #d8a565 0 18px, #c69053 18px 34px, #ba7e46 34px 52px),
    linear-gradient(180deg, #d9a76b 0%, #ac6d3d 100%);
  box-shadow: 0 16px 0 #0000002e;
}

.ballot-box::before,
.ballot-box::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  border: 2px solid #0000001e;
  pointer-events: none;
}

.ballot-poster {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) rotate(-2deg);
  width: 65%;
  padding: 0.75rem 0.6rem;
  border-radius: 6px;
  border: 3px solid #6d4a2f;
  background: #f8efe0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 7px 0 #0000001d;
}

.confirm-slide {
  position: absolute;
  top: 49%;
  left: 50%;
  transform: translate(-50%, 12px) scale(0.92);
  width: min(360px, calc(100vw - 1.5rem));
  border-radius: 18px;
  border: 3px solid #2e2018;
  background: var(--panel);
  padding: 1rem;
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
  box-shadow: 0 16px 32px #00000033;
}

.confirm-slide p {
  margin: 0 0 0.9rem;
  text-align: center;
  font-weight: 900;
  font-size: 1.12rem;
}

.confirm-slide.from-left {
  left: 22%;
}

.confirm-slide.from-right {
  left: 78%;
}

.confirm-slide.open {
  left: 50%;
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.confirm-actions {
  display: grid;
  gap: 0.55rem;
}

.confirm-btn {
  border: 2px solid #2f2118;
  border-radius: 12px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 700;
}

.confirm-yes {
  background: #50c265;
  color: #fff;
}

.confirm-no {
  background: #f0e3d0;
}

.vote-status {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: var(--glass);
  border: 2px solid #2e2018;
  border-radius: 12px;
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 16;
  max-width: min(90vw, 450px);
  text-align: center;
}

.lock-notice {
  position: absolute;
  top: 6.3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  margin: 0;
  background: linear-gradient(180deg, #390f0be8, #270e0be8);
  color: #fff8ef;
  border: 2px solid #f7c16d;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px #00000038;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(
      -45deg,
      #0000005e 0 16px,
      #3f0e0a5e 16px 32px
    ),
    radial-gradient(circle at 50% 30%, #ffffff12, #000000a8 78%);
  backdrop-filter: blur(2px);
  animation: lock-overlay-flicker 0.9s steps(2, jump-none) infinite;
}

.lock-overlay-card {
  width: min(520px, calc(100vw - 2rem));
  border-radius: 18px;
  border: 3px solid #ffd16f;
  background:
    linear-gradient(180deg, #35130fef, #190907ef);
  color: #fff7ec;
  text-align: center;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 0 0 5px #00000048, 0 20px 40px #00000055;
  animation: lock-card-pulse 1.2s ease-in-out infinite;
}

.lock-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: #ffce87;
  font-weight: 900;
}

.lock-overlay-card h2 {
  margin: 0.35rem 0 0.45rem;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: 0.08em;
  font-weight: 900;
  text-shadow: 0 0 12px #ff8f5e99;
}

.lock-countdown {
  margin: 0;
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
  color: #ffe9ca;
  font-weight: 700;
}

.winner-overlay {
  position: absolute;
  inset: 0;
  z-index: 19;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #ffffff0d 0%, #000000c2 78%);
  backdrop-filter: blur(2px);
}

.winner-overlay-card {
  width: min(620px, calc(100vw - 2rem));
  border-radius: 22px;
  border: 3px solid #ffdf97;
  background:
    linear-gradient(150deg, #2e0f0ce8 0%, #19121de8 45%, #0f1d33e8 100%);
  text-align: center;
  color: #fff8ea;
  padding: 1.4rem 1.1rem;
  box-shadow: 0 24px 48px #00000066;
  animation: winner-burst 0.7s ease;
}

.winner-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #ffd89a;
  font-weight: 900;
}

.winner-overlay-card h2 {
  margin: 0.45rem 0 0.35rem;
  font-size: clamp(1.7rem, 5.2vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-shadow: 0 0 18px #ffffff52;
}

.winner-overlay-card p {
  margin: 0;
}

.closed-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  background: #1f1a16ed;
  color: #fff8ea;
  border: 3px solid #f4debd;
  border-radius: 20px;
  padding: 0.75rem 1.6rem;
  font-size: clamp(1.5rem, 4vw, 2.7rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  box-shadow: 0 16px 30px #00000052;
}

@keyframes ambient-drift {
  0% {
    background-position: 0% 0%, 100% 0%, 50% 0%, 0 0;
  }

  100% {
    background-position: 8% 7%, 93% 10%, 50% 0%, 0 0;
  }
}

@keyframes shell-enter {
  0% {
    transform: translateY(12px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes side-shimmer {
  0% {
    transform: translateX(-2%);
  }

  50% {
    transform: translateX(2%);
  }

  100% {
    transform: translateX(-2%);
  }
}

@keyframes card-bob {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes vote-glow {
  0% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.05);
  }

  100% {
    filter: brightness(1);
  }
}

@keyframes vote-text-bob {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-1px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes header-drop {
  0% {
    transform: translate(-50%, -24px);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes header-sheen {
  0% {
    transform: translateX(-120%);
  }

  20% {
    transform: translateX(120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes unread-pulse {
  0% {
    box-shadow: 0 10px 20px #0000002b, inset 0 0 0 1px #ffffff70, 0 0 0 0 #d6372838;
  }

  70% {
    box-shadow: 0 10px 20px #0000002b, inset 0 0 0 1px #ffffff70, 0 0 0 12px #d6372800;
  }

  100% {
    box-shadow: 0 10px 20px #0000002b, inset 0 0 0 1px #ffffff70, 0 0 0 0 #d6372800;
  }
}

@keyframes chat-in {
  0% {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes lock-overlay-flicker {
  0% {
    opacity: 0.88;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.9;
  }
}

@keyframes lock-card-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 5px #00000048, 0 20px 40px #00000055;
  }

  50% {
    transform: scale(1.016);
    box-shadow: 0 0 0 5px #00000048, 0 26px 46px #00000067;
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 5px #00000048, 0 20px 40px #00000055;
  }
}

@keyframes winner-burst {
  0% {
    transform: scale(0.82);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-sidebar {
  position: fixed;
  right: 0.8rem;
  top: 0.8rem;
  width: min(390px, 96vw);
  height: calc(100vh - 1.6rem);
  z-index: 40;
  transform: translateX(calc(100% - 64px));
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.chat-sidebar.open {
  transform: translateX(0);
}

.chat-sidebar.hidden-by-admin {
  opacity: 0;
  pointer-events: none;
}

.chat-toggle {
  position: absolute;
  left: -76px;
  top: 1rem;
  width: 76px;
  height: 58px;
  border-radius: 16px 0 0 16px;
  border: 2px solid #201811;
  border-right: 0;
  background: linear-gradient(180deg, #fff8ec, #ecd9bd);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #332218;
  box-shadow: 0 10px 20px #0000002b, inset 0 0 0 1px #ffffff70;
  display: grid;
  place-items: center;
  padding-top: 0.1rem;
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.chat-toggle:hover {
  transform: translateX(-2px);
}

.chat-toggle.open {
  background: linear-gradient(180deg, #ffe9be, #f2cb82);
}

.chat-toggle.has-unread {
  animation: unread-pulse 1.2s ease-in-out infinite;
}

.chat-toggle-label {
  font-size: 0.76rem;
}

.chat-unread {
  position: absolute;
  right: 8px;
  top: 6px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #d63728;
  color: #fff;
  font-size: 0.7rem;
  display: grid;
  place-items: center;
  padding: 0 0.35rem;
  font-weight: 800;
  box-shadow: 0 0 0 0 #d637285f;
}

.panel-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #fff7ebf0, #f8e7cdf0),
    var(--chat-shell);
  border: 2px solid var(--chat-line);
  border-right-width: 3px;
  border-radius: 22px;
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px #0000002f;
  overflow: hidden;
  transform: translateX(14px) scale(0.985);
  opacity: 0.4;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.chat-sidebar.open .panel-view {
  transform: translateX(0) scale(1);
  opacity: 1;
}

.hidden {
  display: none !important;
}

.panel-header {
  padding: 0.9rem 1rem 0.8rem;
  border-bottom: 2px solid #221911;
  background: linear-gradient(180deg, #f4e3c5, #ecd7b4);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: 0.02em;
  font-family: var(--font-heading);
}

.panel-header p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.chat-name-row {
  margin: 0.35rem 0 0;
  padding: 0.2rem 0.45rem;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid #9a7b55;
  background: #fff3dd;
  font-size: 0.74rem;
  font-weight: 700;
  color: #5a402b;
}

.chat-subline {
  color: #7b5c42;
  margin-top: 0.2rem;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
  background:
    radial-gradient(circle at 8% 4%, #ffffffd9, transparent 30%),
    linear-gradient(180deg, #fff9ee 0%, #fff5e5 100%);
}

.chat-messages::-webkit-scrollbar {
  width: 11px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #ead9bd;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c5a57c;
  border: 2px solid #ead9bd;
  border-radius: 10px;
}

.chat-message {
  background: #fffefc;
  border: 1px solid #dcc8ad;
  border-left: 4px solid #b28656;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 4px 12px #00000015;
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.chat-message:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px #0000001d;
}

.chat-message-new {
  animation: chat-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-message-self {
  border-left-color: #2f78df;
  background: linear-gradient(180deg, #eef6ff, #e5f1ff);
}

.chat-message-self .chat-meta {
  color: #2a568e;
}

.chat-message-system {
  border-left-color: #4b4b4b;
  background: linear-gradient(180deg, #f8f8f8, #efefef);
}

.chat-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.35rem;
  color: #6f5844;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.chat-meta > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-role {
  border: 1px solid #8f6c46;
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #6e4c2e;
  background: #fff6e8;
}

.chat-message-system .chat-role {
  border-color: #707070;
  color: #4f4f4f;
  background: #ffffff;
}

.chat-message-self .chat-role {
  border-color: #2f78df;
  color: #1f5cb8;
  background: #f3f8ff;
}

.chat-time {
  opacity: 0.8;
}

.chat-text {
  margin: 0;
  word-break: break-word;
  font-size: 0.9rem;
}

.chat-quick-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem 0;
  overflow-x: auto;
  background: linear-gradient(180deg, #fff5e0 0%, #fbead0 100%);
}

.emoji-chip {
  border: 2px solid #2f2118;
  border-radius: 999px;
  min-width: 42px;
  min-height: 34px;
  background: #fff4df;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: 0 4px 8px #00000014;
}

.emoji-chip:disabled {
  filter: grayscale(1);
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem;
  border-top: 2px solid #221911;
  background: linear-gradient(180deg, #f5e5ca, #e8cfaa);
}

.chat-form input,
.admin-command-form input {
  width: 100%;
  min-height: 44px;
  border: 2px solid #2f2219;
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  background: #fff;
  box-shadow: inset 0 1px 0 #ffffff, 0 3px 7px #0000000c;
}

.chat-form input:focus,
.admin-command-form input:focus,
.lock-row input:focus {
  outline: 3px solid #22448f66;
  border-color: var(--focus);
}

.chat-form button,
.admin-command-form button,
.tiny-btn {
  min-height: 44px;
  border: 2px solid #2f2118;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd787, #f6be4d);
  font-weight: 800;
  cursor: pointer;
  padding: 0 0.9rem;
  transition: transform 0.12s ease, filter 0.2s ease;
}

.chat-form button:hover,
.admin-command-form button:hover,
.tiny-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.chat-disabled-notice {
  margin: 0.6rem 0.8rem 0;
  border: 2px dashed #513821;
  border-radius: 10px;
  padding: 0.4rem;
  text-align: center;
  background: #fff4cc;
  font-weight: 700;
}

.admin-panel {
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.admin-panel .panel-header {
  position: sticky;
  top: 0;
  z-index: 5;
}

.admin-panel::-webkit-scrollbar {
  width: 10px;
}

.admin-panel::-webkit-scrollbar-track {
  background: #eedfca;
}

.admin-panel::-webkit-scrollbar-thumb {
  background: #c9aa81;
  border: 2px solid #eedfca;
  border-radius: 10px;
}

.admin-help {
  margin: 0;
  padding: 0.7rem 0.9rem 0.2rem;
  font-size: 0.84rem;
  color: #5d4938;
}

.lock-scheduler {
  margin: 0.55rem 0.8rem 0.35rem;
  border: 2px solid #2b1f16;
  border-radius: 12px;
  background: #fff7ea;
  padding: 0.55rem;
}

.lock-scheduler label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #674b34;
  margin-bottom: 0.35rem;
}

.lock-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.lock-row input {
  min-height: 42px;
  border: 2px solid #2f2119;
  border-radius: 10px;
  padding: 0.2rem 0.45rem;
}

.lock-presets {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.preset-btn {
  border: 2px solid #2f2219;
  border-radius: 10px;
  min-height: 32px;
  background: #f9e6c1;
  font-weight: 800;
  cursor: pointer;
}

.admin-controls {
  padding: 0.5rem 0.8rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
}

.admin-btn {
  min-height: 42px;
  border: 2px solid #2f2219;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffeac1, #f7d79f);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease;
}

.admin-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.admin-btn-critical {
  border-color: #6b1712;
  background: linear-gradient(180deg, #ffb7ac, #ef7567);
  color: #42110d;
}

.admin-inline-group {
  padding: 0.35rem 0.8rem 0.2rem;
  display: grid;
  gap: 0.45rem;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
}

.admin-inline-form select,
.admin-inline-form input {
  min-height: 40px;
  border: 2px solid #2f2119;
  border-radius: 10px;
  padding: 0.3rem 0.5rem;
  background: #fff;
}

.admin-inline-form button {
  min-height: 40px;
  border: 2px solid #2f2118;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd787, #f6be4d);
  font-weight: 800;
  cursor: pointer;
  padding: 0 0.75rem;
}

.admin-inline-form:last-child {
  grid-template-columns: 1fr auto;
}

.winner-controls {
  padding: 0.45rem 0.8rem 0.2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.winner-btn {
  min-height: 38px;
  border: 2px solid #2f2219;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
}

.winner-btn-blue {
  background: linear-gradient(180deg, #2f78df, #1d52af);
}

.winner-btn-red {
  background: linear-gradient(180deg, #dd5548, #b62f24);
}

.winner-btn-tie {
  background: linear-gradient(180deg, #736d66, #524d47);
}

.admin-command-form {
  padding: 0.7rem 0.8rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.admin-status {
  margin: 0;
  padding: 0.2rem 0.9rem 1rem;
  font-size: 0.86rem;
  color: #473728;
}

.admin-debug-panel {
  margin: 0 0.8rem 0.8rem;
  border: 2px solid #2f2118;
  border-radius: 12px;
  background: #fff8ed;
  overflow: hidden;
}

.admin-debug-panel h3 {
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid #2f2118;
  background: #f4dfba;
}

.admin-debug-panel pre {
  margin: 0;
  padding: 0.5rem 0.65rem 0.6rem;
  font-size: 0.72rem;
  line-height: 1.35;
  max-height: 118px;
  overflow: auto;
  color: #3f2f24;
  background: #fffefb;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0503038f;
  display: grid;
  place-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.app-modal-card {
  width: min(420px, calc(100vw - 1rem));
  border-radius: 16px;
  border: 2px solid #2d2118;
  background: linear-gradient(180deg, #fff6e4, #f4dfbd);
  padding: 1rem;
  box-shadow: 0 18px 40px #00000054;
}

.app-modal-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.app-modal-card p {
  margin: 0.5rem 0 0;
  color: #533e2d;
}

.modal-input {
  width: 100%;
  min-height: 42px;
  border: 2px solid #2f2219;
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  margin-top: 0.65rem;
  background: #fff;
}

.modal-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-btn {
  min-height: 38px;
  border-radius: 10px;
  border: 2px solid #2f2118;
  font-weight: 800;
  cursor: pointer;
  padding: 0 0.8rem;
}

.modal-btn-cancel {
  background: #f2e8d8;
}

.modal-btn-confirm {
  background: linear-gradient(180deg, #ffd787, #f6be4d);
}

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: grid;
  gap: 0.45rem;
}

.toast {
  max-width: min(320px, 88vw);
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 2px solid #1f1610;
  background: #fff5e3;
  color: #2f2218;
  font-weight: 700;
  box-shadow: 0 8px 20px #00000036;
  animation: toast-in 0.22s ease;
}

.toast.error {
  background: #ffe5df;
  border-color: #7f1e15;
  color: #5f140d;
}

.reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
}

.reaction-pill {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 2px solid #201811;
  background: #fff8e9eb;
  font-size: 1.25rem;
  font-weight: 800;
  animation: float-up 3.2s ease forwards;
  box-shadow: 0 6px 12px #00000020;
}

.ballot-token {
  position: fixed;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #26190f;
  box-shadow: 0 8px 16px #00000038;
  z-index: 36;
  pointer-events: none;
}

.ballot-token-blue {
  background: radial-gradient(circle at 32% 28%, #c9f0ff 0%, #5cb3ff 62%, #1f64ca 100%);
}

.ballot-token-red {
  background: radial-gradient(circle at 32% 28%, #ffd2c9 0%, #ff7b66 58%, #c5372a 100%);
}

.confetti-piece {
  position: fixed;
  top: -14px;
  width: 9px;
  height: 16px;
  border-radius: 2px;
  opacity: 0.9;
  pointer-events: none;
  z-index: 35;
  animation: confetti-drop 2.8s linear forwards;
}

@keyframes float-up {
  0% {
    transform: translate(-50%, 0) scale(0.8);
    opacity: 0;
  }

  12% {
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -58vh) scale(1.2);
    opacity: 0;
  }
}

@keyframes confetti-drop {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(102vh) rotate(680deg);
    opacity: 0;
  }
}

@keyframes toast-in {
  0% {
    transform: translateY(8px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1080px) {
  .side {
    padding: 7rem 3vw 11rem;
  }

  .ballot-wrap {
    width: min(290px, 40vw);
    height: 350px;
  }

  .vote-btn {
    min-height: 78px;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .page-shell {
    min-height: 100vh;
    height: auto;
  }

  .arena {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(350px, 1fr) minmax(350px, 1fr);
  }

  .side {
    padding: 7rem 6vw 9rem;
    min-height: 44vh;
  }

  .ballot-wrap {
    bottom: 1.2rem;
    width: min(260px, 58vw);
    height: 318px;
  }

  .tug-header {
    width: min(720px, calc(100vw - 1rem));
    top: 0.5rem;
  }

  .tug-track {
    height: 58px;
  }

  .tug-handle {
    height: 46px;
  }

  .lock-notice {
    top: 4.8rem;
    max-width: calc(100vw - 1.2rem);
    text-align: center;
  }

  .chat-sidebar {
    right: 0.4rem;
    top: auto;
    bottom: 0.4rem;
    width: min(360px, 94vw);
    height: min(76vh, 640px);
    transform: translateX(calc(100% - 58px));
  }

  .admin-controls {
    grid-template-columns: 1fr 1fr;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .admin-inline-form:last-child {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    right: 0.6rem;
    left: 0.6rem;
    bottom: 0.6rem;
  }

  .vote-status {
    bottom: 0.4rem;
  }
}
