:root {
  --bg: #f4f2ee;
  --ink: #171717;
  --muted: #68645d;
  --line: #d8d2c8;
  --panel: #ffffff;
  --accent: #0f7b63;
  --accent-ink: #ffffff;
  --danger: #9f2d2d;
  --shadow: 0 12px 30px rgba(25, 24, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.admin-topbar h1,
.admin-topbar p,
.panel h2,
.panel h3 {
  margin: 0;
}

.admin-topbar h1 {
  font-size: 26px;
  line-height: 1.15;
}

.admin-topbar p,
.muted-line,
.meta-line,
.deck-main span,
.widget-row span {
  color: var(--muted);
  font-size: 14px;
}

.admin-layout {
  width: min(1520px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.narrow-panel {
  width: min(420px, 100%);
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: #34312c;
  font-size: 14px;
}

.stack-form input,
.stack-form textarea,
.stack-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fffefa;
  color: var(--ink);
}

.stack-form textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.link-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-ink);
}

.secondary-button,
.link-button {
  background: #fffefa;
  color: var(--ink);
  border-color: var(--line);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  margin: 0;
  font-size: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 10px;
}

.deck-list,
.widget-list {
  display: grid;
  gap: 10px;
}

.deck-row,
.widget-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffefa;
}

.deck-row.selected {
  border-color: var(--accent);
}

.deck-main {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  min-width: 0;
}

.deck-main strong,
.widget-row strong {
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-panel {
  min-height: 520px;
}

.detail-content {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.meta-line {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.widget-form {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.widget-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.visual-editor {
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.visual-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.visual-editor-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 18px;
  align-items: start;
}

.composer-controls {
  display: grid;
  gap: 12px;
}

.composer-controls label {
  display: grid;
  gap: 6px;
  color: #34312c;
  font-size: 14px;
}

.composer-controls input,
.composer-controls textarea,
.composer-controls select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fffefa;
  color: var(--ink);
}

.composer-controls input[type="color"] {
  min-height: 40px;
  padding: 4px;
}

.composer-controls input[type="range"] {
  padding: 0;
}

.image-tools {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.image-tools h4 {
  margin: 0;
  font-size: 15px;
}

.image-list {
  display: grid;
  gap: 8px;
}

.image-list-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  background: #fffefa;
}

.image-list-row.selected {
  border-color: var(--accent);
}

.image-select-button {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 9px !important;
}

.checkbox-line input {
  width: auto !important;
}

.preview-slide-controls {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.preview-slide-controls .secondary-button {
  width: 42px;
  min-height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.preview-slide-controls span {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
}

.slide-composer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050609;
  cursor: crosshair;
  user-select: none;
}

.slide-composer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  pointer-events: none;
}

.selection-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.selection-box {
  position: absolute;
  display: grid;
  min-width: 48px;
  min-height: 36px;
  outline: 2px solid #45d483;
  outline-offset: 0;
  overflow: hidden;
  pointer-events: auto;
  cursor: move;
}

.selection-fill {
  position: absolute;
  inset: 0;
}

.selection-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 18px;
  pointer-events: none;
}

.selection-content strong {
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.selection-content span {
  color: currentColor;
  opacity: 0.78;
  font-size: 14px;
}

.selection-readout {
  margin: 8px 0 0;
}

.resize-handle {
  position: absolute;
  z-index: 4;
  width: 12px;
  height: 12px;
  border: 2px solid #071016;
  border-radius: 50%;
  background: #45d483;
  pointer-events: auto;
}

.resize-handle.nw {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}

.resize-handle.n {
  left: calc(50% - 6px);
  top: -6px;
  cursor: ns-resize;
}

.resize-handle.ne {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}

.resize-handle.e {
  right: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.resize-handle.se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.resize-handle.s {
  left: calc(50% - 6px);
  bottom: -6px;
  cursor: ns-resize;
}

.resize-handle.sw {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}

.resize-handle.w {
  left: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.composer-images {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.builder-image {
  position: absolute;
  z-index: 5;
  overflow: visible;
  outline: 2px solid transparent;
  pointer-events: auto;
  cursor: move;
}

.builder-image.selected {
  outline-color: #45d483;
}

.builder-image img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.builder-image .resize-handle {
  display: none;
}

.builder-image.selected .resize-handle {
  display: block;
}

.chat-editor {
  display: grid;
  gap: 16px;
}

.chat-main-block > .visual-editor-grid {
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
}

.chat-editor .slide-composer {
  aspect-ratio: 16 / 9;
  width: min(100%, 860px);
}

.admin-editor-block {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.chat-main-block {
  padding-top: 0;
  border-top: 0;
}

.block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.block-title-row h4 {
  margin: 0;
  font-size: 16px;
}

.block-title-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.chat-save-actions,
.hydration-save-actions,
.chat-qr-actions {
  justify-content: flex-start;
}

.chat-pending-note {
  margin: -4px 0 0;
}

.chat-preview-box {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 74px;
  min-height: 70px;
  padding: 12px;
  overflow: hidden;
  cursor: move;
  pointer-events: auto;
  outline: 2px dashed var(--chat-preview-accent, #45d483);
  outline-offset: 5px;
  font-size: var(--chat-preview-font-size, 18px);
}

.chat-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.chat-preview-head strong,
.chat-preview-message strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview-head span {
  color: var(--chat-preview-accent, #45d483);
  font-size: calc(var(--chat-preview-font-size, 18px) * 0.72);
}

.chat-preview-message {
  display: grid;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 0;
  padding: calc(var(--chat-preview-font-size, 18px) * 0.45);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
}

.chat-preview-message strong {
  font-size: calc(var(--chat-preview-font-size, 18px) * 0.84);
}

.chat-preview-message p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: var(--chat-preview-font-size, 18px);
}

.hydration-editor-grid {
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 430px);
  align-items: start;
}

.hydration-preview-stage {
  position: relative;
  justify-self: start;
  width: min(100%, 430px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050609;
  --chat-preview-accent: #45d483;
  --chat-preview-font-size: 18px;
}

.hydration-config {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.hydration-config h4 {
  margin: 0;
  font-size: 15px;
}

.hydration-config label {
  display: grid;
  gap: 6px;
  color: #34312c;
  font-size: 14px;
}

.hydration-config input,
.hydration-config select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fffefa;
  color: var(--ink);
}

.hydration-config input[type="color"] {
  min-height: 40px;
  padding: 4px;
}

.hydration-config input[type="file"] {
  padding: 8px;
}

.hydration-config .control-row {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.hydration-items {
  display: grid;
  gap: 8px;
}

.hydration-item-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.hydration-item-row img,
.hydration-item-empty {
  width: 46px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #fffefa;
}

.hydration-item-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chat-preview-hydration {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: calc(var(--chat-preview-font-size, 18px) * 0.6);
  padding: calc(var(--chat-preview-font-size, 18px) * 0.7);
  border-radius: inherit;
  background: color-mix(in srgb, var(--chat-preview-accent, #45d483) 10%, rgba(0, 0, 0, 0.86));
  pointer-events: none;
}

.chat-preview-hydration strong {
  color: var(--chat-preview-accent, #45d483);
  font-size: calc(var(--chat-preview-font-size, 18px) * 1.08);
  line-height: 1.08;
}

.chat-preview-hydration-body {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.chat-preview-hydration img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 5px;
}

.chat-preview-hydration .hydration-word {
  position: absolute;
  left: 50%;
  z-index: 2;
  max-width: none;
  margin: 0;
  color: var(--hydration-preview-text-color, #ffffff);
  font-size: var(--hydration-preview-text-size, 54px);
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  overflow-wrap: normal;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.5),
    0 10px 28px rgba(0, 0, 0, 0.88),
    0 0 22px color-mix(in srgb, var(--hydration-preview-alt-color, #45d483) 55%, transparent);
}

.chat-preview-hydration[data-text-position="top"] .hydration-word {
  top: 7%;
  transform: translateX(-50%);
}

.chat-preview-hydration[data-text-position="center"] .hydration-word {
  top: 50%;
  transform: translate(-50%, -50%);
}

.chat-preview-hydration[data-text-position="bottom"] .hydration-word {
  bottom: 7%;
  transform: translateX(-50%);
}

.chat-qr-box {
  display: grid;
  gap: 8px;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.chat-qr-box img {
  width: min(180px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.chat-qr-box p {
  margin: 0;
  overflow-wrap: anywhere;
}

.viewer-body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.viewer-shell {
  position: fixed;
  inset: 0;
  background: #000;
}

#deckFrame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.overlay-stage {
  position: fixed;
  pointer-events: none;
  z-index: 5;
}

.presenter-hotspot {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 7;
  width: min(560px, 42vw);
  height: min(220px, 28vh);
  min-width: 320px;
  min-height: 140px;
  background: transparent;
}

.presenter-bar {
  position: fixed;
  z-index: 8;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #f8f8f8;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  visibility: hidden;
}

.presenter-bar.visible,
.presenter-bar:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.presenter-bar span:first-child {
  font-weight: 700;
  max-width: 260px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presenter-bar span:nth-child(2) {
  margin-left: auto;
  color: #d8d8d8;
}

.presenter-bar button,
.presenter-bar a {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 5px 9px;
  text-decoration: none;
  cursor: pointer;
}

.presenter-bar button.active {
  border-color: rgba(69, 212, 131, 0.9);
  background: rgba(69, 212, 131, 0.24);
}

.slide-freeze-surface {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}

.slide-builder-image {
  position: absolute;
  z-index: 6;
  pointer-events: none;
}

.slide-builder-image img {
  width: 100%;
  height: 100%;
  display: block;
}

.poll-widget {
  position: absolute;
  overflow: hidden;
  pointer-events: auto;
  color: var(--poll-text, #f7f8f8);
  font-family: var(--poll-font, "Helvetica Neue", Arial, sans-serif);
  z-index: 5;
}

.poll-widget.card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #151515;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.poll-widget.integrated {
  display: block;
  padding: clamp(18px, 2.2vw, 44px);
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.poll-erase-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--poll-erase, #071016);
  opacity: var(--poll-erase-opacity, 1);
}

.poll-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(12px, 1.6vw, 26px);
  height: 100%;
  min-height: 0;
}

.poll-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.poll-header h2 {
  margin: 0;
  font-size: 38px;
  line-height: 1.08;
  color: var(--poll-text, #f7f8f8);
  font-weight: 700;
}

.poll-header span {
  flex: 0 0 auto;
  font-size: 18px;
  color: var(--poll-muted, #b8c0c2);
}

.poll-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.88fr) 1fr;
  gap: 22px;
  min-height: 0;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: clamp(12px, 1.4vw, 24px);
  align-content: start;
}

.qr-tile {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  min-width: 0;
}

.qr-tile img {
  width: min(100%, 210px);
  aspect-ratio: 1;
  display: block;
}

.qr-tile strong {
  color: var(--poll-text, #f7f8f8);
  font-size: 21px;
  text-align: center;
  overflow-wrap: anywhere;
}

.results {
  display: grid;
  gap: 14px;
  align-content: center;
  min-width: 0;
}

.result-row {
  display: grid;
  gap: 8px;
}

.result-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--poll-text, #f7f8f8);
  font-size: 22px;
}

.result-label span {
  overflow-wrap: anywhere;
}

.result-track {
  height: clamp(12px, 1.3vw, 22px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.result-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--poll-accent, #45d483);
  transition: width 220ms ease;
}

.live-chat-widget {
  position: absolute;
  z-index: 7;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: calc(var(--chat-font-size, 18px) * 0.6);
  overflow: hidden;
  padding: calc(var(--chat-font-size, 18px) * 0.7);
  border: var(--chat-border-width, 1px) solid var(--chat-border, rgba(69, 212, 131, 0.75));
  border-radius: var(--chat-radius, 8px);
  background: var(--chat-background, rgba(5, 6, 9, 0.62));
  color: var(--chat-text, #f7f8f8);
  font-family: var(--chat-font, "Helvetica Neue", Arial, sans-serif);
  pointer-events: none;
}

.live-chat-widget.hydration-active .live-chat-header strong {
  color: var(--chat-accent, #45d483);
  font-size: calc(var(--chat-font-size, 18px) * 1.34);
  line-height: 1.02;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.live-chat-widget.hydration-active .live-chat-header span {
  color: var(--chat-muted, #b8c0c2);
  padding-top: calc(var(--chat-font-size, 18px) * 0.22);
}

.chat-reaction-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.chat-reaction-particle {
  position: absolute;
  left: var(--reaction-x, 50%);
  bottom: 6%;
  color: var(--chat-accent, #45d483);
  font-size: clamp(20px, calc(var(--chat-font-size, 18px) * 1.2 * var(--reaction-size, 1)), 48px);
  line-height: 1;
  opacity: 0;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, 0) scale(0.68);
  animation: chatReactionFloat 2.25s cubic-bezier(0.21, 0.78, 0.28, 1) var(--reaction-delay, 0ms) forwards;
}

@keyframes chatReactionFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.68) rotate(-8deg);
  }
  12% {
    opacity: 0.92;
  }
  72% {
    opacity: 0.82;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--reaction-drift, 0px)), calc(-1 * var(--reaction-rise, 360px))) scale(1.08) rotate(14deg);
  }
}

.live-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.live-chat-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(var(--chat-font-size, 18px) * 1.22);
}

.live-chat-header span {
  flex: 0 0 auto;
  color: var(--chat-muted, #b8c0c2);
  font-size: calc(var(--chat-font-size, 18px) * 0.78);
}

.live-chat-hydration {
  position: absolute;
  inset: calc(var(--chat-font-size, 18px) * 3.45) calc(var(--chat-font-size, 18px) * 0.7) calc(var(--chat-font-size, 18px) * 0.7);
  z-index: 3;
  display: grid;
  place-items: stretch;
  min-width: 0;
  min-height: 0;
  padding: calc(var(--chat-font-size, 18px) * 0.65);
  border: 1px solid color-mix(in srgb, var(--chat-accent, #45d483) 75%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--chat-accent, #45d483) 8%, rgba(0, 0, 0, 0.88));
}

.hydration-media-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.hydration-media-stage img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 5px;
}

.hydration-word {
  position: absolute;
  left: 50%;
  z-index: 2;
  max-width: none;
  margin: 0;
  color: var(--hydration-word-color, #ffffff);
  font-size: clamp(18px, var(--hydration-word-size, 54px), 120px);
  font-weight: 950;
  line-height: 0.94;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  overflow-wrap: normal;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.55),
    0 12px 34px rgba(0, 0, 0, 0.92),
    0 0 26px color-mix(in srgb, var(--hydration-word-color, #ffffff) 50%, transparent);
  animation: hydrationWordPop 220ms ease-out;
}

.live-chat-hydration[data-text-position="top"] .hydration-word,
.mobile-chat-hydration[data-text-position="top"] .hydration-word {
  top: 7%;
  transform: translateX(-50%);
}

.live-chat-hydration[data-text-position="center"] .hydration-word,
.mobile-chat-hydration[data-text-position="center"] .hydration-word {
  top: 50%;
  transform: translate(-50%, -50%);
}

.live-chat-hydration[data-text-position="bottom"] .hydration-word,
.mobile-chat-hydration[data-text-position="bottom"] .hydration-word {
  bottom: 7%;
  transform: translateX(-50%);
}

@keyframes hydrationWordPop {
  from {
    opacity: 0;
    letter-spacing: 0.08em;
  }
  to {
    opacity: 1;
    letter-spacing: 0;
  }
}

.live-chat-widget.hydration-active .live-chat-messages {
  opacity: 0.24;
}

.live-chat-messages {
  display: flex;
  flex-direction: column;
  gap: calc(var(--chat-font-size, 18px) * 0.45);
  min-height: 0;
  overflow: hidden;
  justify-content: flex-end;
}

.live-chat-message {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: calc(var(--chat-font-size, 18px) * 0.52);
  border-left: 3px solid var(--chat-accent, #45d483);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.live-chat-message strong {
  color: var(--chat-accent, #45d483);
  font-size: calc(var(--chat-font-size, 18px) * 0.84);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-chat-message p {
  margin: 0;
  color: var(--chat-text, #f7f8f8);
  font-size: var(--chat-font-size, 18px);
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.vote-body {
  min-height: 100vh;
  background: var(--bg);
}

.vote-shell {
  width: min(560px, calc(100vw - 28px));
  margin: 32px auto;
}

.vote-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.vote-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

.vote-options {
  display: grid;
  gap: 12px;
}

.vote-button {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.primary-vote {
  background: var(--accent);
  color: var(--accent-ink);
}

.mobile-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.chat-body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
}

.chat-shell {
  width: min(620px, 100%);
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: flex;
  min-width: 0;
}

.chat-panel h1 {
  margin: 0 0 8px;
  color: var(--chat-text, var(--ink));
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1.08;
}

.chat-panel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chat-panel > p {
  margin: 0 0 16px;
  color: var(--chat-muted, var(--muted));
}

.themed-chat-body {
  background: #020506;
  color: var(--chat-text, #f7f8f8);
  font-family: var(--chat-font, "Helvetica Neue", Arial, sans-serif);
}

.themed-chat-body .chat-panel {
  border: var(--chat-border-width, 1px) solid var(--chat-border, rgba(69, 212, 131, 0.75));
  border-radius: var(--chat-radius, 8px);
  background: var(--chat-background, rgba(5, 6, 9, 0.62));
  box-shadow: none;
}

.chat-room {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.mobile-chat-messages {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: calc(var(--chat-font-size, 18px) * 0.45);
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  padding-right: 2px;
}

.mobile-chat-message {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-left: 3px solid var(--chat-accent, #45d483);
  border-radius: 6px;
  padding: calc(var(--chat-font-size, 18px) * 0.52);
  background: rgba(255, 255, 255, 0.08);
}

.mobile-chat-message strong {
  color: var(--chat-accent, #45d483);
  font-size: calc(var(--chat-font-size, 18px) * 0.84);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-chat-message p {
  margin: 0;
  color: var(--chat-text, #f7f8f8);
  font-size: var(--chat-font-size, 18px);
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.mobile-chat-hydration {
  position: absolute;
  inset: 92px 12px 138px;
  z-index: 3;
  display: grid;
  place-items: stretch;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--chat-border, rgba(69, 212, 131, 0.75));
  border-radius: max(6px, var(--chat-radius, 8px));
  background: color-mix(in srgb, var(--chat-accent, #45d483) 8%, rgba(0, 0, 0, 0.88));
}

.themed-chat-body .chat-panel.hydration-active .mobile-chat-messages {
  opacity: 0.24;
}

.chat-name-form,
.chat-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.chat-name-form {
  margin-top: auto;
  margin-bottom: auto;
}

.chat-name-form label,
.chat-form label {
  display: grid;
  gap: 6px;
  color: var(--chat-text, #f7f8f8);
  font-size: 14px;
}

.chat-name-form input,
.chat-form input,
.chat-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--chat-text, #f7f8f8);
}

.chat-form textarea {
  min-height: 58px;
  max-height: 34dvh;
  resize: none;
}

.chat-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.chat-reaction-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.chat-reaction-bar button {
  width: 100%;
  aspect-ratio: 1.45;
  border: 1px solid var(--chat-border, rgba(69, 212, 131, 0.75));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--chat-text, #f7f8f8);
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1;
  cursor: pointer;
}

.chat-reaction-bar button:active {
  transform: translateY(1px) scale(0.98);
}

.chat-reaction-bar button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.chat-name-form input:focus,
.chat-form textarea:focus {
  border-color: var(--chat-accent, #45d483);
  outline: 2px solid color-mix(in srgb, var(--chat-accent, #45d483) 35%, transparent);
}

.themed-chat-body .primary-button {
  border: 1px solid var(--chat-accent, #45d483);
  background: var(--chat-accent, #45d483);
  color: #03120b;
}

.themed-chat-body .form-error {
  color: var(--chat-muted, #b8c0c2);
}

.chat-popup-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #020506;
}

.chat-popup-body .chat-shell {
  width: 100vw;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.chat-popup-body .presenter-chat-shell {
  padding: 10px;
}

.chat-popup-body .presenter-chat-monitor {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  pointer-events: auto;
}

.chat-pip-body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #020506;
}

.floating-chat-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 10px;
}

.floating-chat-monitor {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  pointer-events: auto;
}

.chat-popup-body .chat-panel {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-popup-body .chat-panel h1 {
  font-size: 22px;
}

.chat-popup-body .mobile-chat-messages {
  min-height: 0;
}

.chat-popup-body .chat-form textarea {
  min-height: 76px;
  resize: vertical;
}

@media (max-width: 860px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    padding: 18px 16px;
  }

  .poll-widget {
    padding: 16px;
  }

  .poll-header h2 {
    font-size: 24px;
  }

  .poll-body {
    grid-template-columns: 1fr;
  }

  .presenter-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .visual-editor-grid {
    grid-template-columns: 1fr;
  }

  .chat-main-block > .visual-editor-grid,
  .hydration-editor-grid {
    grid-template-columns: 1fr;
  }

  .chat-editor .slide-composer {
    width: 100%;
  }

  .visual-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .control-row {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) {
  .presenter-hotspot {
    display: none;
  }

  .presenter-bar {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    visibility: visible;
  }
}
