:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --line: #d7e0ea;
  --line-strong: #b8c6d8;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #d9f8f2;
  --warning: #b42318;
  --board: #fffdf5;
  --shadow: 0 16px 42px rgba(16, 24, 40, 0.08);
  --display-scale: 1;
}
* { box-sizing: border-box; }
html, body {
  min-height: 100%;
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--soft);
  color: var(--ink);
}
button, textarea { font: inherit; }
button { cursor: pointer; }
.display-page { overflow: hidden; }
.display-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  height: 100vh;
  padding: 16px;
}
.display-stage, .panel, .input-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.display-stage {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: clamp(20px, 2vw, 30px);
}
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
  padding-bottom: 18px;
  border-bottom: 1px solid #e7edf4;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
}
h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(38px, 4.1vw, 68px);
  line-height: 1.05;
}
.room-label {
  display: inline-flex;
  align-items: center;
  margin: 12px 0 0;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  background: #f8fafc;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
}
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}
.status.live {
  border-color: #99eadc;
  background: var(--accent-soft);
  color: #075e56;
}
.status.live::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
}
.speech-board {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 18px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.94)), var(--board);
  overflow: auto;
  padding: clamp(26px, 4vw, 64px);
}
.empty {
  max-width: 12em;
  margin: 0;
  color: #667085;
  font-size: clamp(48px, 6.3vw, 106px);
  font-weight: 900;
  line-height: 1.14;
  text-align: center;
}
.speech-text {
  display: none;
  width: 100%;
  margin: auto;
  color: #1f2937;
  font-weight: 850;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.has-text .empty { display: none; }
.has-text .speech-text { display: block; }
.short {
  max-width: 12.5em;
  font-size: calc(clamp(48px, 7.4vw, 124px) * var(--display-scale));
  line-height: 1.16;
  text-align: center;
}
.medium {
  max-width: 16em;
  font-size: calc(clamp(36px, 5vw, 82px) * var(--display-scale));
  line-height: 1.24;
  text-align: center;
}
.long {
  max-width: 20em;
  font-size: calc(clamp(28px, 3.6vw, 58px) * var(--display-scale));
  line-height: 1.36;
  text-align: left;
}
.extra {
  max-width: 24em;
  font-size: calc(clamp(22px, 2.8vw, 42px) * var(--display-scale));
  line-height: 1.44;
  text-align: left;
}
.panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.panel section {
  border-bottom: 1px solid #e2e8f0;
  padding: 22px;
}
.panel section:last-child { border-bottom: 0; }
.panel-title {
  margin: 0 0 14px;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
}
.qr {
  display: block;
  width: min(100%, 230px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.url {
  margin: 14px 0 0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  color: #475467;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-all;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.panel button {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
  font-size: 21px;
  background: var(--accent);
  color: #fff;
}
.panel button:not(.light):hover { background: var(--accent-dark); }
.panel button.light {
  background: #e8eef5;
  color: #111827;
}
.panel button.light:hover { background: #dbe4ef; }
.panel section:nth-child(3) {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 12px;
  align-items: end;
}
.panel section:nth-child(3) .panel-title {
  grid-column: 1 / -1;
}
.count {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 34px;
  font-weight: 900;
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}
.speaker-page { min-height: 100vh; background: #eef6f5; }
.speaker-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 22px 16px 32px;
}
.speaker-shell h1 { font-size: clamp(30px, 8vw, 48px); }
.speaker-status, .input-meta {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.input-card {
  padding: 18px;
  margin: 18px 0 14px;
}
.input-card label {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 900;
}
textarea {
  width: 100%;
  min-height: 430px;
  border: 2px solid #b6c3d1;
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.55;
  resize: vertical;
}
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.18);
}
.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
}
.clear-local {
  width: 100%;
  min-height: 66px;
  border: 0;
  border-radius: 8px;
  background: #e8eef5;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
}
@media (max-width: 1100px) {
  .display-page { overflow: auto; }
  .display-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  .display-stage { min-height: 68vh; }
}
@media (max-width: 560px) {
  .display-shell, .speaker-shell { padding: 12px; }
  .top { display: block; }
  .status { margin-top: 14px; }
  .input-meta { display: block; }
}

/* UI cleanup: hide extra labels and keep action buttons under font controls */
.eyebrow,
.room-label,
.url {
  display: none !important;
}

.panel section {
  padding: 18px 22px !important;
}

.panel section:nth-child(3) {
  display: grid !important;
  grid-template-columns: 1fr 86px !important;
  gap: 12px !important;
  align-items: end !important;
}

.panel section:nth-child(3) .panel-title {
  grid-column: 1 / -1 !important;
}

.qr {
  width: min(100%, 230px) !important;
}

/* Hide non-essential display labels and URL text */
.eyebrow,
.room-label,
.url {
  display: none !important;
}

/* Make the right panel tighter so useful controls stay visible */
.panel section {
  padding: 18px 22px !important;
}

/* Put export and clear right under font controls */
.panel section:nth-child(3) {
  display: grid !important;
  grid-template-columns: 1fr 86px !important;
  gap: 12px !important;
  align-items: end !important;
}

.panel section:nth-child(3) .panel-title {
  grid-column: 1 / -1 !important;
}

.qr {
  width: min(100%, 230px) !important;
}

/* requested display cleanup */
.empty,
.empty-text {
  display: none !important;
}

.speech-board:not(.has-text) .speech-text {
  display: block !important;
}

.url,
.url-text {
  display: block !important;
  margin: 12px 0 0 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  padding: 9px 10px !important;
  color: #475467 !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  word-break: break-all !important;
}

.panel,
.control-panel {
  justify-content: flex-start !important;
}

.panel section,
.panel-section {
  padding: 16px 20px !important;
}

.qr,
.qr-code {
  width: min(100%, 218px) !important;
}

.panel section:nth-child(3),
.control-panel .panel-section:nth-child(3) {
  display: block !important;
}

.panel section:nth-child(3) .panel-title,
.control-panel .panel-section:nth-child(3) .panel-title {
  display: block !important;
}

.stack {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.stack .secondary-action,
.stack .light {
  width: 100% !important;
}

.status-panel {
  display: none !important;
}

/* requested display cleanup */
.empty,
.empty-text {
  display: none !important;
}

.speech-board:not(.has-text) .speech-text {
  display: block !important;
}

.url,
.url-text {
  display: block !important;
  margin: 12px 0 0 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  padding: 9px 10px !important;
  color: #475467 !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  word-break: break-all !important;
}

.panel,
.control-panel {
  justify-content: flex-start !important;
}

.panel section,
.panel-section {
  padding: 16px 20px !important;
}

.qr,
.qr-code {
  width: min(100%, 218px) !important;
}

.panel section:nth-child(3),
.control-panel .panel-section:nth-child(3) {
  display: block !important;
}

.panel section:nth-child(3) .panel-title,
.control-panel .panel-section:nth-child(3) .panel-title {
  display: block !important;
}

.stack {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.stack .secondary-action,
.stack .light {
  width: 100% !important;
}

.status-panel {
  display: none !important;
}

/* hide QR URL and status helper text */
.url,
.url-text,
.status-help,
.hint {
  display: none !important;
}

/* right-panel-visibility-fix:start */
.control-panel,
.panel {
  overflow-y: auto;
  overflow-x: hidden;
}

.stack {
  grid-template-columns: minmax(0, 1fr) 86px;
}

.icon-button,
.primary-action,
.secondary-action,
.clear-local-button,
.panel button {
  line-height: 1.15;
}

.primary-action,
.secondary-action {
  white-space: nowrap;
}

@media (max-height: 820px) and (min-width: 1101px) {
  .display-shell {
    gap: 14px;
    padding: 10px;
  }

  .display-stage {
    padding: 18px;
  }

  .stage-top,
  .top {
    padding-bottom: 12px;
  }

  .speech-board {
    margin-top: 12px;
  }

  .panel-section,
  .panel section {
    padding: 12px 18px;
  }

  .panel-title {
    margin-bottom: 10px;
    font-size: 20px;
  }

  .qr-code,
  .qr {
    width: min(100%, 178px);
    padding: 8px;
  }

  .icon-button,
  .primary-action,
  .secondary-action,
  .clear-local-button,
  .panel button {
    min-height: 48px;
    font-size: 19px;
  }
}

@media (max-height: 680px) and (min-width: 1101px) {
  .qr-code,
  .qr {
    width: min(100%, 148px);
  }

  .panel-section,
  .panel section {
    padding: 10px 16px;
  }

  .button-row,
  .row,
  .stack {
    gap: 10px;
  }
}
/* right-panel-visibility-fix:end */
