*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  color: #1f1f1f;
  line-height: 1.5;
}

.main-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 24px;
  padding: 32px;
  padding-bottom: 16px;
  margin: 0 auto;
  min-height: calc(100vh - 66px);
}

.panel {
  background-color: #ffffff;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.panel h1,
.panel h2,
.panel h3 {
  margin-top: 0;
}

.session-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.session-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.session-panel__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.session-panel__header h3 {
  margin: 0;
}

.session-panel__create {
  padding: 12px 24px;
}

.status-message {
  margin: 0;
  color: #4a4a4a;
  min-height: 24px;
}

.status-list {
  margin: 0;
  padding-left: 20px;
  color: #4a4a4a;
}

.status-list li {
  margin-bottom: 6px;
}

.session-panel__qr {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.qr-url {
  margin: 0;
  font-size: 14px;
  color: #0a84ff;
  word-break: break-all;
  text-align: center;
  font-family: monospace;
  text-decoration: underline;
  cursor: pointer;
}

.qr-url:hover {
  color: #1d91ff;
}

#qrcode {
  display: block;
  width: min(400px, 100%);
}

.students-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.students-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.students-panel__header h3 {
  margin: 0;
}

.students-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
}

.students-list::-webkit-scrollbar {
  width: 6px;
}

.students-list::-webkit-scrollbar-thumb {
  background: #c7cce8;
  border-radius: 999px;
}

.student-item {
  background: none;
  border: none;
  text-align: left;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 12px;
  color: #1f1f1f;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: default;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background-color: rgba(255, 255, 255, 0.8);
  word-break: break-word;
}

.student-item:hover {
  background-color: #f2f4ff;
}

.student-item--clicked {
  background-color: #e8f9f1;
  color: #1f8a50;
  font-weight: 600;
}

.student-item--yes {
  background-color: rgba(46, 204, 113, 0.18);
  color: #16794c;
  font-weight: 600;
}

.student-item--no {
  background-color: rgba(231, 76, 60, 0.18);
  color: #a1281e;
  font-weight: 600;
}

button {
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 999px;
  background: linear-gradient(180deg, #58b6ff 0%, #0a84ff 100%);
  color: #ffffff;
  transition: transform 0.15s ease-in-out, background 0.3s ease-in-out;
}

button:hover:not(:disabled) {
  background: linear-gradient(180deg, #6bc0ff 0%, #1d91ff 100%);
  transform: translateY(-1px);
}

button:focus-visible {
  outline: 0;
}

button:disabled {
  background: linear-gradient(180deg, #dce6f7 0%, #bacdeb 100%);
  color: rgba(15, 23, 42, 0.45);
  cursor: not-allowed;
  transform: none;
}

.live-panel__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  width: 100%;
}

.live-panel__count {
  margin: 0;
  font-size: 144px;
  font-weight: 700;
  color: #1f1f1f;
  transition: color 0.3s ease;
}

.live-panel__count.timer-expired {
  color: #dc2626;
}

.live-panel__detail {
  margin: 0;
  font-size: 20px;
  color: #4a4a4a;
}

.live-panel__stats,
.live-panel__type,
.live-panel__choice {
  width: 100%;
  max-width: 720px;
}

.live-panel__stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 45vh;
}

.live-panel__type {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  min-height: 45vh;
}

.live-panel__type-summary {
  font-size: 18px;
  color: rgba(31, 31, 31, 0.8);
  text-align: center;
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  min-height: 120px;
  flex: 1;
}

.word-cloud__word {
  font-weight: 600;
  color: #1f3b8a;
  transition: transform 0.2s ease;
}

.word-cloud__word:hover {
  transform: scale(1.05);
}

.type-stopwatch {
  font-size: 144px;
  font-weight: 700;
  color: #1f1f1f;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  transition: color 0.3s ease;
}

.type-stopwatch.timer-expired {
  color: #dc2626;
}

.live-panel__choice {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 45vh;
}

.choice-meter {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 48px;
  width: 100%;
  max-width: 720px;
}

.live-panel__choice.choice-timer-active .choice-meter {
  grid-template-columns: 1fr;
}

.live-panel__choice.choice-timer-active .choice-meter__item--no {
  display: none;
}

.live-panel__choice.choice-timer-active .choice-meter__item--yes {
  justify-content: center;
  align-items: center;
}

.choice-meter__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.choice-meter__item--yes {
}

.choice-meter__item--no {
}

.choice-meter__value {
  font-size: 144px;
  font-weight: 700;
  color: #1f1f1f;
  transition: color 0.3s ease;
}

.choice-meter__value.timer-expired {
  color: #dc2626;
}

.choice-meter__detail {
  display: flex;
  align-items: center;
  gap: 4px;
}

.choice-meter__label {
  font-size: 20px;
  font-weight: normal;
  color: #4a4a4a;
}


.choice-meter__percent {
  font-size: 20px;
  font-weight: normal;
  color: #4a4a4a;
}

.choice-meter__percent::before {
  content: "(";
}

.choice-meter__percent::after {
  content: ")";
}

.live-panel__controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  width: 100%;
  max-width: 720px;
}

.live-panel__modes {
  display: flex;
  justify-content: center;
}

.segment-control {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: rgba(229, 229, 234, 0.85);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.segment-option {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #0a84ff;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  min-width: 88px;
  transform: none;
  flex: 1 1 auto;
  text-align: center;
}

.segment-option:hover {
  background: rgba(10, 132, 255, 0.12);
  transform: none;
}

.segment-option.active {
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18);
  transform: none;
}

.segment-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.live-panel__actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.quiz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.quiz-toggle__text {
  font-size: 16px;
  font-weight: 600;
  color: #4a4a4a;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 34px;
  transition: 0.4s;
}

.toggle-switch__slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: 0.4s;
}

.toggle-switch input:checked + .toggle-switch__slider {
  background-color: #009688;
}

.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(22px);
}



.live-panel__round,
.live-panel__finish {
  padding: 14px 28px;
  min-width: 105px;
}

.hidden {
  display: none !important;
}

body.live-mode {
  background-color: #101522;
  color: #ffffff;
  min-height: 100vh;
}

body.live-mode .main-layout {
  display: none;
}

body.live-mode .panel {
  background: none;
  border: none;
  border-radius: 0;
}

body.live-mode .live-panel__content {
  min-height: 100vh;
  padding: 48px 32px;
  gap: 28px;
}

body.live-mode .quiz-toggle__text {
  color: rgba(255, 255, 255, 0.85);
}

body.live-mode .toggle-switch__slider {
  background-color: rgba(255, 255, 255, 0.35);
}

body.live-mode .toggle-switch__slider::before {
  background-color: #ffffff;
}

body.live-mode .toggle-switch input:checked + .toggle-switch__slider {
  background-color: rgba(255, 255, 255, 0.85);
}

body.live-mode .toggle-switch input:checked + .toggle-switch__slider::before {
  background-color: #101522;
}

body.live-mode .toggle-switch input:focus-visible + .toggle-switch__slider {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
}

body.live-mode .live-panel__count {
  color: #ffffff;
  font-size: clamp(8rem, 24vw, 20rem);
}

body.live-mode .live-panel__count.timer-expired {
  color: #ff6b6b;
}

body.live-mode .live-panel__detail {
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
}

body.live-mode .word-cloud {
  background: rgba(16, 21, 34, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

body.live-mode .word-cloud__word {
  color: rgba(173, 201, 255, 0.95);
}

body.live-mode .type-stopwatch {
  color: #ffffff;
  font-size: clamp(8rem, 24vw, 20rem);
}

body.live-mode .type-stopwatch.timer-expired {
  color: #ff6b6b;
}

body.live-mode .choice-meter__label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
}

body.live-mode .choice-meter__value {
  color: #ffffff;
  font-size: clamp(8rem, 24vw, 20rem);
}

body.live-mode .choice-meter__value.timer-expired {
  color: #ff6b6b;
}

body.live-mode .choice-meter__percent {
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
}

body.live-mode .segment-control {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

body.live-mode .segment-option {
  color: rgba(255, 255, 255, 0.85);
}

body.live-mode .segment-option.active {
  background: rgba(255, 255, 255, 0.92);
  color: #163974;
}

body.live-mode .live-panel__round {
  background-color: rgba(255, 255, 255, 0.9);
  color: #101522;
}

body.live-mode .live-panel__round:hover {
  background-color: rgba(255, 255, 255, 0.75);
}

body.live-mode .live-panel__finish {
  background-color: #ff8787;
  color: #101522;
}

body.live-mode .live-panel__finish:hover {
  background-color: #ffa8a8;
}

body.chart-mode {
  background-color: #eef1ff;
}

.chart-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
  background-color: #f5f5f5;
}

.chart-panel h2 {
  margin: 0;
  text-align: center;
}

#chartCanvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 12px;
  background-color: #ffffff;
}

.chart-panel__ok {
  align-self: center;
  padding: 12px 48px;
  background-color: #3366ff;
  color: #ffffff;
}

.chart-panel__ok:hover {
  background-color: #274bcc;
}

body.live-mode .chart-panel,
body.chart-mode .live-panel {
  display: none;
}

body.student-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 32px;
  background: radial-gradient(circle at top, #1f3b8a 0%, #0b1d58 55%, #050d2c 100%);
}


.student-name {
  position: absolute;
  top: -48px;
  width: 100%;
  text-align: center;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.student-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(90vw, 420px);
  height: min(90vw, 420px);
}

.student-name-form {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(82vw, 320px);
  padding: 22px 24px;
  background: rgba(5, 13, 44, 0.92);
  border-radius: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.student-name-form__label {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
}

.student-name-form__input {
  padding: 12px 16px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  text-align: center;
}

.student-name-form__input:focus-visible {
  outline: 3px solid rgba(88, 182, 255, 0.6);
  outline-offset: 2px;
}

.student-name-form__error {
  margin: 0;
  font-size: 14px;
  color: #ffb4b4;
  text-align: center;
}

.student-name-form__submit {
  width: 100%;
}

.student-response-form {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(88vw, 360px);
  padding: 26px 28px;
  background: rgba(5, 13, 44, 0.92);
  border-radius: 32px;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.48);
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.student-response-form__label {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
}

.student-response-form__input {
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: 18px;
  border: none;
  font-size: 17px;
  resize: vertical;
}

.student-response-form__input:focus-visible {
  outline: 3px solid rgba(88, 182, 255, 0.6);
  outline-offset: 2px;
}

.student-response-form__error {
  margin: 0;
  font-size: 14px;
  color: #ffb4b4;
  text-align: center;
}

.student-response-form__submit {
  width: 100%;
}

.student-choice {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  height: 100%;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 4px;
}

.student-choice__option {
  flex: 1;
  border: none;
  border-radius: 32px;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
  transform: none;
}

.student-choice__option--yes {
  background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 100%);
  box-shadow: 0 8px 24px rgba(167, 243, 208, 0.5);
}

.student-choice__option--no {
  background: linear-gradient(180deg, #fecaca 0%, #fca5a5 100%);
  box-shadow: 0 8px 24px rgba(254, 202, 202, 0.5);
}

.student-choice__option:hover:not(:disabled) {
  transform: translateY(-2px);
}

.student-choice__option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.student-choice__option--selected {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45);
}

.student-button {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 36px;
  background: linear-gradient(180deg, #58b6ff 0%, #0a84ff 100%);
  color: #ffffff;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.15s ease, background 0.25s ease;
}


.student-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #6bc0ff 0%, #1d91ff 100%);
  transform: translateY(-1px);
}



.student-button:not(:disabled):active {
  transform: scale(0.98);
  background: linear-gradient(180deg, #3fa7ff 0%, #0077e6 100%);
}


.student-button:disabled {
  background: linear-gradient(180deg, #d6e2f5 0%, #b9c7e0 100%);
  color: rgba(15, 23, 42, 0.45);
  transform: none;
}


.student-ended {
  position: absolute;
  bottom: -56px;
  width: 100%;
  text-align: center;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

@media (max-width: 1100px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .students-list {
    max-height: 320px;
  }
}

@media (max-width: 900px) {
  .session-panel__header {
    flex-direction: column;
    align-items: stretch;
  }

  .session-panel__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .session-panel__random {
    justify-content: space-between;
  }

  .session-panel__create {
    width: 100%;
  }

  .students-panel__header {
    flex-direction: column;
    align-items: stretch;
  }

  #chartCanvas {
    height: 360px;
  }

  body.student-page {
    padding: 32px 20px;
  }

  .student-wrapper {
    width: min(92vw, 360px);
    height: min(92vw, 360px);
  }

  .student-ended {
    bottom: -36px;
    font-size: 16px;
  }

  body.live-mode .live-panel__content {
    padding: 40px 24px;
  }
}



@media (max-width: 640px) {
  .main-layout {
    padding: 16px;
    gap: 16px;
  }

  .students-list {
    max-height: 280px;
  }

  body.student-page {
    padding: 24px 12px;
  }

  .student-wrapper {
    width: min(94vw, 300px);
    height: min(94vw, 300px);
  }

  .student-button {
    border-radius: 32px;
    font-size: clamp(1.6rem, 8vw, 2.2rem);
  }

  .student-ended {
    bottom: -24px;
    font-size: 14px;
  }

  #chartCanvas {
    height: 320px;
  }

  .segment-control {
    flex-wrap: wrap;
    justify-content: center;
  }

  .segment-option {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}

@media (max-width: 400px) {
  body.student-page {
    padding: 20px 10px;
  }

  .student-wrapper {
    width: 90vw;
    height: 90vw;
  }

  .student-button {
    border-radius: 28px;
  }

  .student-ended {
    bottom: -18px;
    font-size: 13px;
  }

  #chartCanvas {
    height: 280px;
  }

  .student-name-form {
    width: min(92vw, 300px);
    padding: 18px 20px;
  }

  .student-name-form__label {
    font-size: 16px;
  }

  .student-name-form__input {
    font-size: 15px;
  }

  .student-response-form {
    width: min(95vw, 320px);
    padding: 20px 22px;
  }

  .student-choice {
    gap: 12px;
  }
}

.session-panel__create,
.live-panel__round,
.chart-panel__ok {
  background: linear-gradient(180deg, #4c83ff 0%, #1f5bff 100%);
  color: #ffffff;
  border: none;
}

.session-panel__create:hover,
.live-panel__round:hover,
.chart-panel__ok:hover {
  background: linear-gradient(180deg, #5c8eff 0%, #2b64ff 100%);
}

.live-panel__finish {
  background: linear-gradient(180deg, #ff7a7a 0%, #ff4d4f 100%);
  color: #ffffff;
  border: none;
}

.live-panel__finish:hover {
  background: linear-gradient(180deg, #ff8a8a 0%, #ff5f61 100%);
}

button:disabled.live-panel__finish,
button:disabled.live-panel__round,
button:disabled.session-panel__create,
button:disabled.chart-panel__ok {
  background: linear-gradient(180deg, #e5e7eb 0%, #d1d5db 100%);
  color: #94a3af;
}

.footer {
  text-align: center;
  padding: 24px 16px;
  color: #4a4a4a;
  font-size: 14px;
  background-color: #f5f5f5;
}

.participation-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
  background-color: #f5f5f5;
}

.participation-panel h2 {
  margin: 0;
  text-align: center;
}

.participation-table-wrapper {
  flex: 1;
  overflow-y: auto;
  border-radius: 12px;
  background-color: #ffffff;
  padding: 16px;
}

.participation-table {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-collapse: collapse;
}

.participation-table thead {
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 1;
}

.participation-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: #1f1f1f;
  border-bottom: 2px solid #dcdcdc;
}

.participation-table th:last-child {
  text-align: right;
}

.participation-table td {
  padding: 14px 16px;
  color: #4a4a4a;
  border-bottom: 1px solid #f0f0f0;
}

.participation-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: #1f1f1f;
}

.participation-table tbody tr:hover {
  background-color: #f9fafb;
}

.participation-panel__ok {
  align-self: center;
  padding: 12px 48px;
}

/* Leaderboard styles */
.leaderboard-name {
  font-weight: 600;
  width: 30%;
}

.leaderboard-percent {
  text-align: right;
  width: 70%;
}

.progress-container {
  position: relative;
  width: 100%;
  height: 32px;
  background-color: #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 16px;
  animation: fillProgress 1.5s ease-out forwards;
}

@keyframes fillProgress {
  from {
    width: 0;
  }
  to {
    width: var(--target-width);
  }
}

.progress-text {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-weight: 600;
  color: #1f1f1f;
  font-size: 14px;
  z-index: 1;
}

/* Ranking tier colors */
.rank-gold .leaderboard-name {
  color: #d97706;
}

.rank-gold .progress-bar {
  background: linear-gradient(90deg, #fbbf24 0%, #d97706 100%);
}

.rank-silver .leaderboard-name {
  color: #64748b;
}

.rank-silver .progress-bar {
  background: linear-gradient(90deg, #cbd5e1 0%, #64748b 100%);
}

.rank-bronze .leaderboard-name {
  color: #92400e;
}

.rank-bronze .progress-bar {
  background: linear-gradient(90deg, #f59e0b 0%, #92400e 100%);
}

.rank-top10 .leaderboard-name {
  color: #059669;
}

.rank-top10 .progress-bar {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* Help Icon */
.help-icon {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #58b6ff 0%, #0a84ff 100%);
  color: #ffffff;
  border: 1px solid rgba(10, 132, 255, 0.3);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(10, 132, 255, 0.25);
  z-index: 100;
  transition: transform 0.2s ease, background 0.2s ease;
  padding: 0;
  line-height: 1;
}

.help-icon:hover {
  background: linear-gradient(180deg, #6bc0ff 0%, #1d91ff 100%);
  transform: scale(1.1);
}

body.chart-mode .help-icon {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background-color: #ffffff;
  border-radius: 16px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-size: 32px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease;
  transform: none;
}

.modal__close:hover {
  background: #f3f4f6;
  color: #1f1f1f;
  transform: none;
}

.modal__body {
  padding: 32px 40px;
}

.modal__body h2 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #1f1f1f;
  font-size: 24px;
}

.modal__body h3 {
  margin-top: 20px;
  margin-bottom: 8px;
  color: #1f1f1f;
  font-size: 18px;
}

.modal__body p {
  margin: 8px 0;
  color: #4a4a4a;
  line-height: 1.6;
}

.modal__divider {
  margin: 24px 0;
  border: none;
  border-top: 2px solid #e5e7eb;
}

@media (max-width: 640px) {
  .help-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .modal__content {
    width: 95%;
    max-height: 90vh;
  }

  .modal__body {
    padding: 24px 20px;
  }

  .modal__body h2 {
    font-size: 20px;
  }

  .modal__body h3 {
    font-size: 16px;
  }
}
