:root {
  --sand: #e4cba9;
  --sky-blue: #7fc7cc;
  --deep-sea: #092f33;
  --moss-green: #4b5b34;
  --terracotta: #af5031;
  --cherry-blossom: #fdaba5;
  --red-wine: #980204;
  --sunshine: #ea8913;
  --honey: var(--sunshine);
  --honey-soft: #f7dfb6;
  --bee-ink: #183134;
  --bee-brown: #6d5a49;
  --paper: #f8f2e7;
  --line: #bda88d;
  --shadow: rgba(9, 47, 51, 0.16);
  --chrome-blue-top: #76c1c8;
  --chrome-blue-bottom: #3f8e95;
  --chrome-beige: #efe1ca;
  --chrome-panel: #f4eadb;
  --chrome-shadow: #6f7564;
  --chrome-highlight: #fffaf3;
  --chrome-border: #a89778;
  --chrome-well-dark: #7a816c;
  --chrome-well-mid: #d6c8b0;
  --chrome-button-face: #f2c7c0;
  --chrome-button-hover: #f7d7d1;
  --chrome-workspace: #d9ebea;
  --petal-pink: #f6a7c1;
  --petal-rose: #ff87ae;
  --petal-lilac: #c9b5ff;
  --petal-mint: #b9f0c9;
  --petal-sky: var(--sky-blue);
  --petal-apricot: #ffc498;
  --petal-butter: #ffe57a;
  --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='14' cy='6' r='4' fill='%23ff9bc9' stroke='%23a9436d' stroke-width='1.3'/%3E%3Ccircle cx='21' cy='12' r='4' fill='%23ffc4db' stroke='%23a9436d' stroke-width='1.3'/%3E%3Ccircle cx='18' cy='21' r='4' fill='%23ff9bc9' stroke='%23a9436d' stroke-width='1.3'/%3E%3Ccircle cx='10' cy='21' r='4' fill='%23ffc4db' stroke='%23a9436d' stroke-width='1.3'/%3E%3Ccircle cx='7' cy='12' r='4' fill='%23ff9bc9' stroke='%23a9436d' stroke-width='1.3'/%3E%3Ccircle cx='14' cy='14' r='4.1' fill='%23ffd94f' stroke='%238e6c00' stroke-width='1.3'/%3E%3Cpath d='M20 21c2 0 3 1 3 2s-1 2-2 2c-3 0-5-2-7-6' stroke='%23579a42' stroke-width='1.6' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E") 6 4, auto;
  --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='15' cy='7' r='4.3' fill='%23ff9bc9' stroke='%23943d63' stroke-width='1.4'/%3E%3Ccircle cx='22' cy='13' r='4.3' fill='%23ffd1e3' stroke='%23943d63' stroke-width='1.4'/%3E%3Ccircle cx='19' cy='22' r='4.3' fill='%23ff9bc9' stroke='%23943d63' stroke-width='1.4'/%3E%3Ccircle cx='11' cy='22' r='4.3' fill='%23ffd1e3' stroke='%23943d63' stroke-width='1.4'/%3E%3Ccircle cx='8' cy='13' r='4.3' fill='%23ff9bc9' stroke='%23943d63' stroke-width='1.4'/%3E%3Ccircle cx='15' cy='15' r='4.4' fill='%23ffe169' stroke='%23835f00' stroke-width='1.4'/%3E%3Cpath d='M21 22c2.4.2 3.9 1.2 3.9 2.7 0 1.2-.8 1.8-1.8 1.8-3.1 0-5.5-2.2-8.2-7' stroke='%234d9339' stroke-width='1.8' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E") 7 5, pointer;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Courier New", Courier, monospace;
  margin: 0;
  min-height: 100vh;
  padding: 0;
  color: var(--bee-ink);
  cursor: var(--cursor-default);
  background:
    radial-gradient(circle at top left, rgba(228, 203, 169, 0.8), transparent 38%),
    radial-gradient(circle at bottom right, rgba(253, 171, 165, 0.28), transparent 30%),
    linear-gradient(180deg, #eef6f4 0%, #e0efef 46%, #f5efe4 100%);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  border: 2px solid #7b8e87;
  box-shadow:
    inset 1px 1px 0 #fffaf0,
    inset -1px -1px 0 #64736d,
    0 14px 40px rgba(9, 47, 51, 0.18);
  background: var(--chrome-beige);
}

.sidebar {
  width: 230px;
  padding: 10px 10px 18px;
  border-right: 2px solid var(--chrome-border);
  background: #f6e6a9;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #b4a17c;
}

.sidebar-brand {
  margin-bottom: 14px;
  padding: 8px 10px;
  border: 2px solid var(--chrome-border);
  background: #ffd2dd;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #b99c43;
  font-size: 23px;
  font-weight: bold;
  color: #0d3d4d;
}

.nav-link {
  display: block;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 2px solid #9f9073;
  color: var(--bee-ink);
  text-decoration: none;
  font-weight: bold;
  text-align: left;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.75),
    inset -1px -1px 0 rgba(120, 100, 60, 0.55),
    1px 1px 0 rgba(190, 172, 128, 0.95);
  transition:
    background 0.1s ease,
    box-shadow 0.1s ease,
    transform 0.1s ease;
}

.nav-link:hover {
  filter: brightness(1.03);
  cursor: var(--cursor-pointer);
}

.nav-link.active {
  border-color: #7f755a;
  box-shadow:
    inset -2px -2px 0 rgba(255, 255, 255, 0.5),
    inset 2px 2px 0 rgba(105, 92, 56, 0.75);
  transform: translate(1px, 1px);
}

.sidebar .nav-link:nth-of-type(1) {
  background: #f6e6a9;
}

.sidebar .nav-link:nth-of-type(2) {
  background: #ffd6a8;
}

.sidebar .nav-link:nth-of-type(3) {
  background: #bfe4f2;
}

.sidebar .nav-link:nth-of-type(4) {
  background: #ffd2dd;
}

.sidebar .nav-link:nth-of-type(5) {
  background: #d4e2b8;
}

.sidebar .nav-link.active:nth-of-type(1) {
  background: #ebd88f;
}

.sidebar .nav-link.active:nth-of-type(2) {
  background: #f2c28d;
}

.sidebar .nav-link.active:nth-of-type(3) {
  background: #a9d4e5;
}

.sidebar .nav-link.active:nth-of-type(4) {
  background: #f0b9c8;
}

.sidebar .nav-link.active:nth-of-type(5) {
  background: #c2d29d;
}

.page-shell {
  flex: 1;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(127, 199, 204, 0.18), rgba(127, 199, 204, 0.08)),
    #e6f1ef;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 9px 14px;
  border-bottom: 2px solid #4a676a;
  background: linear-gradient(180deg, #17484c 0%, #092f33 100%);
  box-shadow:
    inset 1px 1px 0 #326f72,
    inset -1px -1px 0 #02191b;
}

.topbar-title {
  font-size: 19px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.22);
}

.topbar-subtitle {
  color: #c5e6e6;
  font-size: 12px;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border: 2px solid #7d684e;
  background: #efdfc3;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #9b896f;
}

.topbar-profile-avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid #8f6d56;
  border-radius: 2px;
  background: var(--cherry-blossom);
  color: var(--red-wine);
  font-size: 16px;
  font-weight: bold;
  box-shadow:
    inset 1px 1px 0 #fff4ef,
    inset -1px -1px 0 #b17969;
}

.topbar-profile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.topbar-profile-label {
  color: #7a5f4d;
  font-size: 12px;
}

.topbar-profile-email {
  color: var(--bee-ink);
  font-size: 13px;
  font-weight: bold;
}

.page-content {
  text-align: center;
  width: min(100%, 760px);
  margin: 18px auto;
  padding: 26px 22px 40px;
  border: 2px solid var(--chrome-border);
  background: rgba(248, 242, 231, 0.96);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 var(--chrome-well-mid),
    0 10px 22px rgba(9, 47, 51, 0.12);
}

h1,
h2 {
  margin: 0 0 14px;
  color: var(--bee-ink);
  letter-spacing: -0.2px;
}

p {
  color: var(--bee-brown);
}

a {
  color: var(--terracotta);
  font-weight: bold;
}

input,
select {
  display: block;
  width: min(100%, 360px);
  max-width: 100%;
  margin: 12px auto;
  padding: 9px 10px;
  border: 2px solid var(--chrome-well-dark);
  background: #fffdfa;
  color: var(--bee-ink);
  box-shadow:
    inset 1px 1px 0 #99907c,
    inset -1px -1px 0 #fffdf8;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
}

input:focus,
select:focus {
  outline: 1px dotted var(--deep-sea);
  outline-offset: -4px;
  border-color: #5f674e;
}

button {
  padding: 9px 16px;
  margin: 10px 6px;
  max-width: 100%;
  border: 2px solid #9d836f;
  background: linear-gradient(180deg, #f5d2cb 0%, #fdaba5 100%);
  color: var(--bee-ink);
  font-weight: bold;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #b68874,
    1px 1px 0 #d8ccb8;
  transition: none;
  font-family: "Courier New", Courier, monospace;
  cursor: var(--cursor-pointer);
}

button:hover {
  background: linear-gradient(180deg, #f8ddd7 0%, #f7beb8 100%);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow:
    inset 1px 1px 0 #f6f1e3,
    inset -1px -1px 0 #c9bca0;
}

button:active {
  box-shadow:
    inset -1px -1px 0 var(--chrome-highlight),
    inset 1px 1px 0 #9d836f;
  background: linear-gradient(180deg, #efb8ae 0%, #f5a39f 100%);
  padding-top: 10px;
  padding-bottom: 8px;
}

#options {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#options button {
  width: min(100%, 360px);
}

#status,
#quizCode,
#score,
#points {
  font-weight: bold;
}

.quiz-stage {
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  transition: transform 0.25s ease;
  transform-origin: top center;
}

.quiz-stage #question {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.22;
  letter-spacing: 0;
}

.quiz-stage #options button {
  font-family: inherit;
  font-size: 17px;
  line-height: 1.35;
}

.party-status {
  width: min(100%, 480px);
  margin: 0 auto 18px;
}

.speech-panel {
  width: min(100%, 520px);
  margin: 0 auto 18px;
  padding: 14px 16px;
  border: 2px solid var(--chrome-border);
  text-align: left;
  background: rgba(255, 210, 221, 0.42);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c79a7f;
}

.speech-panel-title {
  margin: 0 0 6px;
  color: var(--deep-sea);
  font-weight: bold;
}

.speech-panel-copy {
  margin: 0 0 10px;
  font-size: 13px;
}

.speech-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.speech-actions button {
  margin: 0;
}

.speech-toggle {
  justify-content: flex-start;
  margin: 12px 0 8px;
}

.speech-status {
  min-height: 18px;
  margin: 0;
  color: var(--moss-green);
  font-size: 13px;
}

.timer-track {
  position: relative;
  height: 48px;
  border: 2px solid var(--chrome-well-dark);
  overflow: hidden;
  background: #efe1ca;
  box-shadow:
    inset 1px 1px 0 #8b806a,
    inset -1px -1px 0 #fffdf6;
}

.timer-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--sunshine) 0%, var(--terracotta) 100%);
  transition: width 0.1s linear;
}

.timer-bee {
  position: absolute;
  top: 9px;
  left: -4px;
  z-index: 1;
  font-size: 26px;
  transition: left 0.1s linear;
}

.timer-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-weight: bold;
  color: var(--bee-ink);
}

.party-controls {
  width: min(100%, 480px);
  margin: 0 auto 22px;
  padding: 16px 18px;
  border: 2px solid var(--chrome-border);
  background: rgba(127, 199, 204, 0.18);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.party-controls-title {
  margin: 0 0 8px;
  color: var(--bee-ink);
  font-weight: bold;
}

.party-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-size: 36px;
  font-weight: bold;
  color: var(--bee-ink);
  background: rgba(248, 242, 231, 0.94);
  pointer-events: none;
}

.battery-overlay {
  background: rgba(234, 137, 19, 0.2);
  font-size: 32px;
}

#leaderboardSection {
  width: min(100%, 420px);
  margin: 20px auto 0;
  padding: 16px 18px;
  border: 2px solid var(--chrome-border);
  background: rgba(253, 171, 165, 0.18);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

#leaderboard {
  text-align: left;
  padding-left: 24px;
}

#leaderboard li {
  margin: 8px 0;
  color: var(--bee-ink);
}

#teamLeaderboardSection {
  width: min(100%, 420px);
  margin: 20px auto 0;
  padding: 16px 18px;
  border: 2px solid var(--chrome-border);
  background: rgba(75, 91, 52, 0.14);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

#teamLeaderboard {
  text-align: left;
  padding-left: 24px;
}

#teamLeaderboard li {
  margin: 8px 0;
  color: var(--bee-ink);
}

.option-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 10px auto;
}

.option-row input {
  margin: 0;
  width: min(100%, 300px);
}

.remove-option-button {
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  font-size: 20px;
  line-height: 1;
}

.remove-option-button:disabled {
  opacity: 0.45;
}

.toggle-label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 15px auto;
  color: var(--bee-ink);
  font-weight: bold;
}

.toggle-label input {
  margin: 0;
  width: auto;
  box-shadow: none;
}

.settings-panel {
  width: min(100%, 420px);
  margin: 14px auto 18px;
  padding: 14px 16px;
  border: 2px solid var(--chrome-border);
  background: rgba(127, 199, 204, 0.16);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.settings-title {
  margin: 0 0 10px;
  font-weight: bold;
  color: var(--bee-ink);
}

.team-badge {
  display: inline-block;
  margin: 0 0 18px;
  padding: 8px 14px;
  border: 2px solid var(--chrome-border);
  background: rgba(234, 137, 19, 0.16);
  color: var(--bee-ink);
  font-weight: bold;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #b79c56;
}

.nested-settings {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(9, 47, 51, 0.18);
}

.settings-inline-label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  color: var(--bee-ink);
}

.image-upload-panel {
  width: min(100%, 420px);
  margin: 14px auto;
  padding: 14px 16px;
  border: 2px solid var(--chrome-border);
  background: rgba(228, 203, 169, 0.28);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.image-upload-panel input[type="file"] {
  width: min(100%, 100%);
}

.image-upload-hint {
  margin: 8px 0 0;
  font-size: 13px;
}

.image-preview {
  margin-top: 12px;
}

.image-preview img,
.question-image-wrap img {
  width: min(100%, 420px);
  max-height: 260px;
  object-fit: contain;
  border: 2px solid var(--chrome-border);
  background: #fffdfa;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.question-image-wrap {
  margin: 0 auto 18px;
}

.qr-panel {
  width: min(100%, 420px);
  margin: 18px auto 0;
  padding: 14px 16px;
  border: 2px solid var(--chrome-border);
  background: rgba(191, 228, 242, 0.26);
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.qr-code-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin-top: 12px;
}

.qr-code-box img,
.qr-code-box canvas {
  display: block;
  max-width: 100%;
  height: auto;
  padding: 10px;
  border: 2px solid var(--chrome-border);
  background: #fffdfa;
  box-shadow:
    inset 1px 1px 0 var(--chrome-highlight),
    inset -1px -1px 0 #c5b28a;
}

.qr-link-text {
  margin: 12px 0 0;
  font-size: 12px;
  word-break: break-all;
}

.hidden {
  display: none;
}

a,
button,
select,
label,
summary {
  cursor: var(--cursor-pointer);
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 2px solid var(--chrome-border);
    padding: 12px;
  }

  .sidebar-brand {
    margin-bottom: 10px;
  }

  .nav-link {
    margin-bottom: 8px;
  }

  .page-content {
    width: calc(100% - 20px);
    margin: 10px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0;
  }

  .sidebar {
    padding: 10px;
  }

  .nav-link {
    text-align: center;
    width: 100%;
    padding: 12px 10px;
  }

  .topbar {
    flex-direction: column;
    text-align: center;
    align-items: stretch;
    padding: 14px 12px;
  }

  .topbar-profile {
    width: 100%;
    justify-content: center;
    gap: 8px;
  }

  .topbar-profile-text {
    align-items: center;
  }

  .page-content {
    width: calc(100% - 12px);
    padding: 20px 12px 28px;
    margin: 6px;
  }

  input,
  select,
  button,
  #options button {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .option-row {
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }

  .option-row input {
    width: 100%;
    min-width: 0;
  }

  .remove-option-button {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
  }

  .speech-panel,
  .party-status,
  .party-controls,
  .settings-panel,
  .image-upload-panel,
  .qr-panel,
  #leaderboardSection,
  #teamLeaderboardSection {
    width: 100%;
    padding: 12px;
  }

  .speech-actions,
  .party-actions {
    flex-direction: column;
  }

  .speech-actions button,
  .party-actions button {
    width: 100%;
  }

  .toggle-label,
  .speech-toggle {
    justify-content: flex-start;
    text-align: left;
  }

  .question-image-wrap img,
  .image-preview img {
    width: 100%;
    max-height: 220px;
  }

  .overlay {
    padding: 20px;
    text-align: center;
    font-size: 28px;
  }

  .battery-overlay {
    font-size: 24px;
  }

  #leaderboard,
  #teamLeaderboard {
    padding-left: 18px;
  }
}
