* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: #2b1a0e;
  background:
    radial-gradient(circle at 12% 18%, #ffe27a 0 90px, transparent 91px),
    radial-gradient(circle at 88% 86%, #ffd24a 0 80px, transparent 81px),
    #fff4c8;
  font: 16px/1.45 "Trebuchet MS", "Verdana", "Segoe UI", sans-serif;
}

.app {
  width: min(720px, calc(100% - 24px));
  margin: 20px auto;
  border: 3px solid #2b1a0e;
  background: #fffdf6;
  box-shadow: 6px 6px 0 #ff6a00;
}

.app.wide {
  width: min(980px, calc(100% - 24px));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 3px solid #2b1a0e;
  color: #2b1a0e;
  background: #ffd24a;
  font-size: 14px;
  font-weight: 700;
}

.live {
  width: 10px;
  height: 10px;
  background: #c9a227;
  border-radius: 50%;
}

.live.on {
  background: #ff6a00;
}

.topbar-rest {
  margin-left: auto;
  color: #6a4a16;
}

.nav {
  display: flex;
  gap: 12px;
}

.nav a {
  color: #2b1a0e;
  text-decoration: none;
}

.nav a:hover,
.nav a.is-current {
  color: #ff6a00;
}

.nav a.twitch-status {
  font-weight: 700;
}

.nav a.twitch-status.is-off {
  color: #d44800;
}

.nav a.twitch-status.is-on {
  color: #2b1a0e;
}

h2 {
  margin: 8px 0 10px;
  color: #ff6a00;
  font: 700 18px "Trebuchet MS", sans-serif;
}

.howto {
  margin: 0 0 22px;
  padding-left: 1.2rem;
  color: #2b1a0e;
}

.howto li {
  margin: 0 0 6px;
}

.live-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 3px solid #2b1a0e;
  background: #ffe27a;
}

[hidden] {
  display: none !important;
}

.btn-stop {
  border-color: #2b1a0e;
  color: #fff;
  background: #ff6a00;
}

.btn-stop:hover:not(:disabled) {
  background: #d44800;
}

.screen {
  display: none;
  padding: 22px 16px 24px;
}

.screen.is-active {
  display: block;
}

h1 {
  margin: 0 0 12px;
  color: #ff6a00;
  font: 800 52px/0.9 Impact, "Arial Black", "Trebuchet MS", sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #ffe27a;
}

.lede, .muted {
  margin: 0 0 18px;
  color: #6a4a16;
}

.stats-line {
  margin: 0 0 18px;
}

.stats-line b {
  color: #ff6a00;
}

.error {
  margin: 0 0 16px;
  color: #d44800;
}

.admin-error {
  margin: 12px 16px 0;
}

.btn, .btn-link {
  appearance: none;
  display: inline-block;
  border: 3px solid #2b1a0e;
  border-radius: 999px;
  padding: 10px 18px;
  color: #2b1a0e;
  background: #ffd24a;
  font: 700 16px "Trebuchet MS", sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2b1a0e;
}

.btn:hover:not(:disabled), .btn-link:hover {
  background: #ffe27a;
  transform: translate(-1px, -1px);
}

.btn:disabled {
  border-color: #b9a88a;
  color: #8a7a62;
  background: #efe6d2;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: #fff1c2;
}

.btn.is-current {
  background: #ffe27a;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: #6a4a16;
}

.hud b { color: #2b1a0e; }

.timer {
  height: 10px;
  margin-bottom: 16px;
  border: 2px solid #2b1a0e;
  background: #ffe27a;
}

.timer-bar {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: #ff6a00;
}

.chat-log {
  min-height: 72px;
  margin: 0 0 16px;
  padding: 10px 12px 12px;
  border: 3px solid #2b1a0e;
  background: #fff1c2;
}

.chat-msg {
  color: #2b1a0e;
  font-size: 20px;
  line-height: 1.35;
  word-break: break-word;
}

.vote-count {
  margin: 8px 0 0;
  color: #ff6a00;
  font-weight: 700;
}

.choice-votes {
  margin-left: auto;
  color: #ff6a00;
}

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

.choices:empty {
  display: none;
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  border: 3px solid #2b1a0e;
  border-radius: 14px;
  background: #fff1c2;
  font-weight: 700;
}

.choice.is-correct {
  background: #ffe27a;
  outline: 4px solid #ff6a00;
}

.choice-n {
  flex: 0 0 auto;
  min-width: 22px;
  color: #ff6a00;
}

.choice-role {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 999px;
  color: #fffdf6;
  background: #2b1a0e;
  font-size: 11px;
  text-transform: uppercase;
}

.board {
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.board li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 2px dashed #ffd24a;
}

.board-full li:nth-child(-n+3) {
  font-size: 18px;
}

.msg-list {
  max-height: min(70vh, 720px);
  overflow: auto;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border: 3px solid #2b1a0e;
  background: #fff1c2;
}

.msg-list li {
  padding: 8px 10px;
  border-top: 2px dashed #ffd24a;
}

.msg-list li:first-child {
  border-top: 0;
}

.msg-list .msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.msg-list .is-hidden .msg-text {
  color: #6a4a16;
}

.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.btn-mini {
  padding: 4px 10px;
  font-size: 13px;
  box-shadow: 2px 2px 0 #2b1a0e;
}

.history {
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.history li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-top: 2px dashed #ffd24a;
}

.history-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.muted a {
  color: #ff6a00;
}

.bars {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.bar {
  position: relative;
  background: #fff1c2;
  border: 2px solid #2b1a0e;
  min-height: 28px;
}

.bar-fill {
  min-height: 28px;
  background: #ffd24a;
}

.bar-label {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #2b1a0e;
  font-weight: 700;
}

.voters {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #6a4a16;
}

.voters li { padding: 3px 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
}

.field input,
.field textarea {
  padding: 10px;
  border: 3px solid #2b1a0e;
  border-radius: 12px;
  color: #2b1a0e;
  background: #fff;
  font: 16px "Trebuchet MS", sans-serif;
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.rules {
  margin: 0 0 22px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.dates {
  border: 3px solid #2b1a0e;
  border-radius: 14px;
  padding: 10px 12px 4px;
  background: #fff1c2;
}

.dates legend {
  padding: 0 6px;
  font-weight: 700;
}

.choice-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 14px 10px 0;
}

.rules-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.split {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 20px;
}

.multi {
  position: relative;
}

.multi-toggle {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 3px solid #2b1a0e;
  border-radius: 12px;
  color: #2b1a0e;
  background: #fff;
  font: 16px "Trebuchet MS", sans-serif;
  cursor: pointer;
}

.multi-toggle:hover {
  background: #fff8dd;
}

.multi-panel {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin-top: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 3px solid #2b1a0e;
  border-radius: 12px;
  background: #fff1c2;
  box-shadow: 4px 4px 0 #2b1a0e;
}

.multi-search {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 2px solid #2b1a0e;
  border-radius: 10px;
  background: #fff;
  font: 15px "Trebuchet MS", sans-serif;
}

.multi-options {
  display: grid;
  gap: 4px;
}

.multi-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.multi-options label:hover {
  background: #ffe27a;
}

.multi-options label.is-off {
  display: none;
}

@media (max-width: 720px) {
  h1 { font-size: 36px; }
  .choices, .split, .rules-grid, .rules-dates { grid-template-columns: 1fr; }
  .chat-msg { font-size: 17px; }
}
