/* =========================================================
   ICEVOX MOBILE — DEEP ICE THEME
   Theme variables ported verbatim from desktop styles.css;
   layout rebuilt mobile-first (single column, bottom tabs).
========================================================= */

/* --- FIXED VARIABLES (same across all themes) --- */
:root {
  --hi-white: rgba(220, 240, 255, 0.9);
  --hi-mid: rgba(100, 150, 200, 0.4);
  --shade-dark: rgba(0, 0, 0, 0.9);
  --primary: #75b8ff;
  --danger: #cf4848;
  --success: #35b87b;
  --text-main: #c4d4e3;
  --text-dim: #6c839e;
  --transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-heading: 'Cinzel', 'Trajan Pro', 'Georgia', serif;
  --font-ui: system-ui, -apple-system, sans-serif;
  --shape-ice-lg: 4px 14px 4px 10px;
  --shape-ice-md: 2px 10px 3px 8px;
  --shape-ice-sm: 2px 6px 2px 4px;
  /* Mobile safe areas (notches, gesture bars) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- MIDNIGHT THEME (default) --- */
[data-theme="midnight"] {
  --bg-deep: #020304;
  --panel-bg: #090e14;
  --accent: #0e1520;
  --accent-hover: #182636;
  --bg-radial-core: #071018;
  --bg-sidebar-a: #060a10;
  --ice-panel-a: #121d2b;
  --ice-panel-b: #0a1018;
  --ice-panel-c: #040608;
  --ice-input-bg: #020304;
  --ice-btn-a: #182636;
  --ice-btn-b: #0e1520;
  --ice-btn-hover-a: #203248;
  --ice-btn-hover-b: #121c28;
  --ice-btn-primary-a: #1a3d65;
  --ice-btn-primary-b: #081626;
  --ice-chat-bg: rgba(2, 3, 4, 0.65);
}

/* --- ARCTIC THEME --- */
[data-theme="arctic"] {
  --bg-deep: #030a14;
  --panel-bg: #071320;
  --accent: #0b1826;
  --accent-hover: #182c46;
  --bg-radial-core: #0a1828;
  --bg-sidebar-a: #06101a;
  --ice-panel-a: #152840;
  --ice-panel-b: #0b1826;
  --ice-panel-c: #040a14;
  --ice-input-bg: #030812;
  --ice-btn-a: #182c46;
  --ice-btn-b: #0e1a2c;
  --ice-btn-hover-a: #203c5c;
  --ice-btn-hover-b: #122236;
  --ice-btn-primary-a: #1a4578;
  --ice-btn-primary-b: #081a34;
  --ice-chat-bg: rgba(3, 8, 16, 0.65);
}

/* --- SLATE THEME (flat, minimalist) --- */
[data-theme="slate"] {
  --hi-white: rgba(180, 200, 220, 0.6);
  --hi-mid: rgba(100, 140, 180, 0.08);
  --shade-dark: rgba(0, 0, 0, 0.25);
  --primary: #6ba3d6;
  --text-main: #c8d0d8;
  --text-dim: #7a8a9a;
  --font-heading: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg-deep: #1e2228;
  --panel-bg: #262b32;
  --accent: #2e343c;
  --accent-hover: #3a424c;
  --bg-radial-core: #22272e;
  --bg-sidebar-a: #21262c;
  --ice-panel-a: #2a3038;
  --ice-panel-b: #262b32;
  --ice-panel-c: #1e2228;
  --ice-input-bg: #181c22;
  --ice-btn-a: #2e343c;
  --ice-btn-b: #262b32;
  --ice-btn-hover-a: #3a424c;
  --ice-btn-hover-b: #323940;
  --ice-btn-primary-a: #3a7abd;
  --ice-btn-primary-b: #2c5f96;
  --ice-chat-bg: rgba(24, 28, 34, 0.8);
}

/* =========================================================
   BASE
========================================================= */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
input, select, textarea, button { font-family: inherit; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-heading);
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 70% 20%, var(--bg-radial-core) 0%, var(--bg-deep) 70%);
  color: var(--text-main);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}
.icon.dim { color: var(--text-dim); }

/* =========================================================
   START OVERLAY
========================================================= */

.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 50% 30%, var(--bg-radial-core) 0%, var(--bg-deep) 75%);
  text-align: center;
}

.start-logo { width: 96px; height: 96px; }

.start-title {
  margin: 0;
  font-size: 34px;
  letter-spacing: 4px;
  color: var(--hi-white);
  text-shadow: 0 2px 12px rgba(117, 184, 255, 0.3);
}

.start-sub {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 14px;
  font-family: var(--font-ui);
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 34px;
  font-size: 18px;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  color: var(--hi-white);
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-lg);
  box-shadow: inset 0 1px 0 var(--hi-white), 0 4px 18px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.start-btn:active { transform: scale(0.97); }

.start-hint {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-ui);
  line-height: 1.5;
}

.start-error {
  color: var(--danger);
  font-family: var(--font-ui);
  font-size: 14px;
  max-width: 320px;
}

/* =========================================================
   APP SHELL
========================================================= */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--safe-top)) 12px 6px;
  background: linear-gradient(180deg, var(--ice-panel-a), var(--ice-panel-b));
  border-bottom: 1px solid var(--hi-mid);
  flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-logo { width: 28px; height: 28px; }
.header-title {
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--hi-white);
  white-space: nowrap;
}

.header-status {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.header-status.st-connected { color: var(--success); }
.header-status.st-waiting { color: var(--primary); }
.header-status.st-error { color: var(--danger); }

.header-actions { display: flex; gap: 2px; }

.hdr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-main);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.hdr-btn:active { background: var(--accent-hover); }
.hdr-btn .icon-muted { display: none; }
.hdr-btn.muted { color: var(--danger); }
.hdr-btn.muted .icon-muted { display: block; }
.hdr-btn.muted .icon-unmuted { display: none; }

/* =========================================================
   VIEWS
========================================================= */

/* [WEB] .views-container owns the flexible area between header and tab bar.
   Narrow screens: one view visible at a time (tabs). Wide screens: grid, all
   three views side by side (see media query at end of file). */
.views-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 20px;
  min-height: 0;
}
.view.view-active { display: block; }

/* Chat view is a column (messages + input pinned at bottom) */
#view-chat.view-active { display: flex; flex-direction: column; padding: 0; }

.section-title {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--hi-white);
  margin: 18px 0 10px;
  text-transform: uppercase;
}
.view .section-title:first-child { margin-top: 0; }

/* =========================================================
   EFFECTS VIEW
========================================================= */

.quick-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-slider-card {
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 var(--hi-white);
}

.qc-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.value-display {
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Range inputs — big touch targets */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--ice-input-bg);
  border: 1px solid var(--hi-mid);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border: 1px solid var(--hi-mid);
  box-shadow: inset 0 1px 0 var(--hi-white), 0 2px 6px rgba(0,0,0,0.5);
}

/* Monitor toggle row */
.monitor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
}
.monitor-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.monitor-info > div { display: flex; flex-direction: column; min-width: 0; }
.monitor-label { font-size: 14px; font-family: var(--font-ui); }
.monitor-desc { font-size: 11px; font-family: var(--font-ui); color: var(--text-dim); }

.monitor-volume-row {
  margin-top: 8px;
  padding: 10px 12px;
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
}

/* Preset grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  box-shadow: inset 0 1px 0 var(--hi-white);
  color: var(--text-main);
  cursor: pointer;
  min-height: 84px;
}
.preset-btn:active { transform: scale(0.96); }
.preset-btn.active {
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border-color: var(--primary);
  color: var(--hi-white);
  box-shadow: inset 0 1px 0 var(--hi-white), 0 0 12px rgba(117, 184, 255, 0.35);
}

.preset-icon-img { width: 42px; height: 42px; }
.preset-name {
  font-size: 11px;
  font-family: var(--font-ui);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Slate: text-only presets */
[data-theme="slate"] .preset-icon-img { display: none; }
[data-theme="slate"] .preset-btn { min-height: 52px; justify-content: center; }
[data-theme="slate"] .preset-name { font-size: 12px; }

.preset-save-hint {
  font-size: 11px;
  font-family: var(--font-ui);
  color: var(--text-dim);
  margin: -4px 0 8px;
}

.saved-grid { grid-template-columns: repeat(3, 1fr); }
.saved-slot { min-height: 56px; justify-content: center; }
.saved-slot:empty::after {
  content: '+';
  font-size: 22px;
  color: var(--text-dim);
}

/* Advanced accordion */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
}
.advanced-toggle .chevron { margin-left: auto; transition: transform 0.2s; }
.advanced-toggle.open .chevron { transform: rotate(180deg); }

.advanced-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.effect-card {
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 var(--hi-white);
}
.effect-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--hi-white);
  text-transform: uppercase;
}
.slider-group { margin-bottom: 6px; }
.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--text-dim);
  margin-bottom: 2px;
}

.reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
}
.reset-btn:active { background: var(--accent-hover); }

/* Slate: flat panels */
[data-theme="slate"] .quick-slider-card,
[data-theme="slate"] .monitor-row,
[data-theme="slate"] .monitor-volume-row,
[data-theme="slate"] .preset-btn,
[data-theme="slate"] .effect-card,
[data-theme="slate"] .advanced-toggle,
[data-theme="slate"] .reset-btn,
[data-theme="slate"] .room-card,
[data-theme="slate"] .participant-row {
  background: var(--panel-bg);
  box-shadow: none;
}

/* =========================================================
   ROOM VIEW
========================================================= */

.room-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-lg);
  box-shadow: inset 0 1px 0 var(--hi-white);
}

.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  font-size: 15px;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  color: var(--text-main);
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  box-shadow: inset 0 1px 0 var(--hi-white);
  cursor: pointer;
  min-height: 50px;
}
.big-btn:active { transform: scale(0.98); }
.big-btn:disabled { opacity: 0.45; }
.big-btn.primary {
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  color: var(--hi-white);
}
.big-btn.danger { color: #ff9a9a; border-color: rgba(207, 72, 72, 0.5); }
/* .half buttons wrap into a 2-column grid when the row runs out of width —
   with four buttons (Invite, Video, Lock, Leave) a single flex row overflows
   and clips the last button in narrow columns/windows. */
.big-btn.half { flex: 1 1 40%; min-width: 0; white-space: nowrap; }

.room-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.room-card .room-btn-row { margin-top: 0; }

.room-or {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-ui);
}

.room-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 15px;
  font-family: var(--font-ui);
  color: var(--text-main);
  background: var(--ice-input-bg);
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-sm);
  outline: none;
}
.room-input:focus { border-color: var(--primary); }
.room-input::placeholder { color: var(--text-dim); }

.password-row { display: flex; align-items: center; gap: 8px; }
.password-row .room-input { flex: 1; }

.room-id-display {
  font-size: 24px;
  letter-spacing: 2px;
  text-align: center;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.room-id-display.small-id { font-size: 17px; text-align: left; }

.waiting-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-ui);
}

.copy-feedback {
  text-align: center;
  color: var(--success);
  font-size: 13px;
  font-family: var(--font-ui);
}

.connected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.role-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--primary);
}
.role-badge img { width: 26px; height: 26px; }

.connection-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(207, 72, 72, 0.15);
  border: 1px solid var(--danger);
  border-radius: var(--shape-ice-sm);
  color: #ff9a9a;
  font-size: 13px;
  font-family: var(--font-ui);
}
.connection-error.warn {
  background: rgba(255, 170, 0, 0.12);
  border-color: #ffaa00;
  color: #ffcf70;
}

/* Participants */
.participant-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}
.participant-header {
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-dim);
}
.name-input { max-width: 150px; padding: 8px 10px; font-size: 13px; }

.participant-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.participant-row {
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  padding: 10px 12px;
}

.participant-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.participant-status { font-size: 11px; }
.participant-status .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.on { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot.off { background: var(--danger); }

.participant-name {
  flex: 1;
  font-size: 15px;
  font-family: var(--font-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.participant-name .host-crown { width: 16px; height: 16px; color: #e8c55a; vertical-align: -2px; margin-left: 4px; }

.participant-mute-btn, .participant-kick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
}
.participant-mute-btn.muted { color: var(--danger); }
.participant-kick-btn { color: var(--text-dim); }
.participant-kick-btn:active, .participant-mute-btn:active { background: var(--accent-hover); }

.participant-volume-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.participant-volume-container input[type="range"] { flex: 1; }
.participant-volume-label {
  min-width: 44px;
  text-align: right;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   CHAT VIEW
========================================================= */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--ice-chat-bg);
}

.chat-message {
  font-size: 14px;
  font-family: var(--font-ui);
  line-height: 1.45;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.chat-sender { font-weight: 600; }
.chat-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 6px;
}
.chat-system {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

.chat-file-card {
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-md);
  padding: 8px 10px;
}
.file-card-header { display: flex; justify-content: space-between; font-size: 12px; }
.file-card-body { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.file-card-icon { font-size: 26px; }
.file-card-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.file-card-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-card-size { font-size: 11px; color: var(--text-dim); }

.file-view-btn {
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--hi-white);
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-sm);
  cursor: pointer;
  white-space: nowrap;
}
.file-view-btn:disabled { opacity: 0.6; }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px calc(8px + var(--safe-bottom) * 0);
  background: linear-gradient(180deg, var(--ice-panel-a), var(--ice-panel-b));
  border-top: 1px solid var(--hi-mid);
  flex-shrink: 0;
}

.chat-input-row input[type="text"] {
  flex: 1;
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font-ui);
  color: var(--text-main);
  background: var(--ice-input-bg);
  border: 1px solid var(--hi-mid);
  border-radius: 20px;
  outline: none;
  min-width: 0;
}
.chat-input-row input[type="text"]:focus { border-color: var(--primary); }

.chat-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
}
.chat-icon-btn.send { color: var(--primary); }
.chat-icon-btn:disabled { opacity: 0.4; }
.chat-icon-btn:active { background: var(--accent-hover); }

/* =========================================================
   BOTTOM TAB BAR
========================================================= */

.tab-bar {
  display: flex;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ice-panel-b), var(--ice-panel-c));
  border-top: 1px solid var(--hi-mid);
  padding-bottom: var(--safe-bottom);
}

.tab-btn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-ui);
  letter-spacing: 0.5px;
  cursor: pointer;
}
.tab-btn.tab-active { color: var(--primary); }

.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 26px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
}

.tab-dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* =========================================================
   MODALS
========================================================= */

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.settings-modal {
  width: 100%;
  max-width: 420px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--ice-panel-a), var(--ice-panel-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--hi-white);
  border-bottom: 1px solid var(--hi-mid);
}

.settings-close-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
}

.settings-body { padding: 14px 16px; overflow-y: auto; }

.settings-section-title {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 10px 0 6px;
}
.settings-body .settings-section-title:first-child { margin-top: 0; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.settings-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-label { font-size: 14px; font-family: var(--font-ui); }
.settings-desc { font-size: 11px; font-family: var(--font-ui); color: var(--text-dim); }

.settings-note {
  margin-top: 12px;
  font-size: 11px;
  font-family: var(--font-ui);
  color: var(--text-dim);
  line-height: 1.5;
}

.device-select {
  max-width: 170px;
  padding: 9px 10px;
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-main);
  background: var(--ice-input-bg);
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-sm);
}

.password-change-row { display: flex; gap: 8px; }
.password-change-row .room-input { flex: 1; }

.confirm-btn {
  padding: 12px 18px;
  font-size: 14px;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  color: var(--hi-white);
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-sm);
  cursor: pointer;
}
.confirm-btn.small { padding: 8px 14px; font-size: 12px; margin-left: auto; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--ice-input-bg);
  border: 1px solid var(--hi-mid);
  border-radius: 14px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--ice-btn-primary-b);
  border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--primary);
}

/* File viewer */
.file-viewer-modal { max-width: 560px; }
.file-viewer-title-text {
  flex: 1;
  font-size: 14px;
  font-family: var(--font-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-viewer-content {
  padding: 14px 16px;
  overflow: auto;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  user-select: text;
  -webkit-user-select: text;
}
.file-viewer-content img { max-width: 100%; border-radius: 4px; }
.file-viewer-content pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--ice-input-bg);
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
}
.file-viewer-content code { background: var(--ice-input-bg); padding: 1px 5px; border-radius: 4px; }

/* About dialog */
.about-body { padding: 18px; text-align: center; }
.about-title { font-size: 24px; letter-spacing: 3px; color: var(--hi-white); }
.about-version { color: var(--text-dim); font-family: var(--font-ui); font-size: 12px; margin: 4px 0 12px; }
.about-description { font-family: var(--font-ui); font-size: 13px; line-height: 1.5; }
.about-tagline { font-family: var(--font-ui); font-size: 12px; color: var(--text-dim); }
.about-links { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.about-link-btn {
  padding: 12px;
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-main);
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  border-radius: var(--shape-ice-sm);
  cursor: pointer;
}

/* Empty states */
.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-ui);
  padding: 26px 10px;
}
.placeholder-img { width: 84px; height: auto; opacity: 0.8; margin-bottom: 6px; }


/* =========================================================
   [WEB] WIDE-SCREEN LAYOUT (desktop browsers)
   All three views shown side by side; tab bar hidden.
========================================================= */

@media (min-width: 900px) {
  .app {
    max-width: 1440px;
    margin: 0 auto;
    border-left: 1px solid var(--hi-mid);
    border-right: 1px solid var(--hi-mid);
  }

  .tab-bar { display: none; }

  .views-container {
    display: grid;
    grid-template-columns: minmax(400px, 1.25fr) minmax(320px, 1fr) minmax(320px, 1fr);
    min-height: 0;
  }

  /* All views always visible, each with its own scroll */
  .view {
    display: block;
    height: 100%;
    border-right: 1px solid var(--hi-mid);
  }
  #view-chat { display: flex; flex-direction: column; padding: 0; border-right: none; }

  /* Slightly denser preset grid in the effects column */
  .preset-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }

  /* Mouse users get hover feedback */
  .preset-btn:hover, .big-btn:hover:not(:disabled) {
    background: linear-gradient(160deg, var(--ice-btn-hover-a), var(--ice-btn-hover-b));
  }
  .preset-btn.active:hover {
    background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  }
  .hdr-btn:hover, .chat-icon-btn:hover:not(:disabled),
  .participant-mute-btn:hover, .participant-kick-btn:hover,
  .settings-close-btn:hover {
    background: var(--accent-hover);
  }
}


/* =========================================================
   VIDEO OVERLAY (in-app video chat)
========================================================= */

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: #000;
}

.video-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--safe-top)) 12px 6px;
  background: linear-gradient(180deg, var(--ice-panel-a), var(--ice-panel-b));
  border-bottom: 1px solid var(--hi-mid);
  flex-shrink: 0;
}
.video-topbar-title {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--hi-white);
  flex: 1;
}
.video-quality { max-width: 140px; }

.video-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 6px;
  padding: 6px;
  grid-template-columns: repeat(auto-fit, minmax(min(46%, 320px), 1fr));
  align-content: center;
}
.video-grid.single-video { grid-template-columns: 1fr; }
.video-grid.two-videos { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
@media (min-width: 700px) {
  .video-grid.two-videos { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
}

.video-cell {
  position: relative;
  background: var(--ice-panel-c, #05080c);
  border: 1px solid var(--hi-mid);
  border-radius: 10px;
  overflow: hidden;
  min-height: 120px;
  cursor: pointer;
}
.video-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-cell.local video { transform: scaleX(-1); } /* mirror own preview */

.video-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 9px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-ui);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-no-camera {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ice-panel-b);
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-ui);
}
.video-no-camera.hidden { display: none; }

/* Focus mode: focused cell fills, others shrink into a bottom strip */
.video-grid.focus-mode {
  display: flex;
  flex-direction: column;
  align-content: stretch;
}
.video-grid.focus-mode .video-cell { min-height: 0; }
.video-grid.focus-mode .video-cell.focused { flex: 1; }
.video-grid.focus-mode .video-cell:not(.focused) {
  height: 90px;
  flex: none;
}

.video-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 10px 0 calc(10px + var(--safe-bottom));
  background: linear-gradient(0deg, var(--ice-panel-b), transparent);
  flex-shrink: 0;
}

.video-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--ice-btn-a), var(--ice-btn-b));
  border: 1px solid var(--hi-mid);
  color: var(--text-main);
  cursor: pointer;
}
.video-ctrl-btn.active {
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  color: var(--hi-white);
  border-color: var(--primary);
}
.video-ctrl-btn:active { transform: scale(0.94); }

.video-fab {
  position: fixed;
  right: 14px;
  bottom: calc(76px + var(--safe-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 24px;
  background: linear-gradient(160deg, var(--ice-btn-primary-a), var(--ice-btn-primary-b));
  border: 1px solid var(--primary);
  color: var(--hi-white);
  font-size: 14px;
  font-family: var(--font-ui);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

/* Green dot on Video buttons when video signals are waiting */
.video-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  margin-left: 4px;
}
