.settings-toggle {
  background: linear-gradient(135deg, var(--poly-primary-alpha), var(--talk-primary-alpha));
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 122, 24, 0.3);
}

.settings-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px var(--poly-primary-glow);
}

.settings-icon {
  font-size: 1.2rem;
  color: white;
}

.quick-settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.quick-settings-overlay:not([hidden]) {
  display: flex;
}

.quick-settings-modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: calc(100% - 48px);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
}

.quick-settings-header h2 {
  color: #f5fbff;
  font-size: 1.4rem;
  margin: 0;
}

.quick-settings-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #a0a0a0;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  padding: 0 4px;
}

.quick-settings-close:hover {
  color: white;
}

.quick-settings-body {
  color: #e0e0e0;
}

.quick-settings-section {
  margin-bottom: 25px;
}

.quick-settings-section h3 {
  font-size: 1.1rem;
  color: var(--poly-primary);
  margin-bottom: 12px;
  margin-top: 0;
}

.quick-settings-field {
  margin-bottom: 8px;
}

.quick-settings-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #e0e0e0;
}

.quick-settings-field select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(255, 122, 24, 0.3);
  border-radius: 10px;
  font-size: 1rem;
  background: rgba(22, 33, 62, 0.86);
  color: white;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ff7a18' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.quick-settings-field select:focus {
  outline: none;
  border-color: var(--poly-primary);
}

.quick-settings-field input[type="range"] {
  width: 100%;
  accent-color: var(--poly-primary);
}

.quick-settings-field input[type="range"]:focus {
  outline: 2px solid rgba(255, 122, 24, 0.44);
  outline-offset: 4px;
}

.quick-settings-note {
  font-size: 0.85rem;
  color: #a0a0a0;
  margin-top: 8px;
  font-style: italic;
}

.quick-settings-warning {
  color: #f0bd84;
}

.quick-settings-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
}

.btn-save {
  background: linear-gradient(135deg, var(--poly-primary), var(--talk-primary));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--poly-primary-glow);
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary-accent {
  background: linear-gradient(135deg, var(--poly-primary), var(--talk-primary));
  color: white;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--poly-primary-glow);
}

.btn-primary-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 560px) {
  .quick-settings-modal {
    padding: 20px;
    width: calc(100% - 24px);
  }

  .quick-settings-header h2 {
    font-size: 1.2rem;
  }

  .settings-toggle {
    width: 32px;
    height: 32px;
  }

  .settings-icon {
    font-size: 1rem;
  }
}

.system-notice {
  position: relative;
  padding: 16px 40px 16px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  background: #0f1b2d;
  border: 1px solid rgba(255, 122, 24, 0.25);
  border-left: 4px solid #ff7a18;
  color: #eef4ff;
}

.system-notice--compound {
  border-left-color: #ff7a18;
  background: #0f1b2d;
}

.system-notice-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.system-notice-header strong {
  display: block;
  font-size: 15px;
  color: #fff2df;
}

.system-notice-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.system-notice-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 6px 0;
  transition: opacity 0.2s ease;
}

.system-notice-row-content {
  flex: 1;
}

.system-notice-row-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0f0ff;
  margin-bottom: 2px;
}

.system-notice-row-text {
  font-size: 13px;
  color: #a8b8cc;
  line-height: 1.4;
}

.system-notice-row--info .system-notice-row-title {
  color: #42a5f5;
}

.system-notice-row--warning .system-notice-row-title {
  color: #ffa726;
}

.system-notice-row--danger .system-notice-row-title {
  color: #e53935;
}

.system-notice-row--success .system-notice-row-title {
  color: #66bb6a;
}

.system-notice-dismiss {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #a8b8cc;
  opacity: 0.6;
  padding: 0 4px;
  line-height: 1;
}

.system-notice-dismiss:hover {
  opacity: 1;
  color: #fff;
}

.confirm-modal-overlay {
  align-items: center;
  background: rgba(2, 6, 18, 0.76);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 1002;
}

.confirm-modal-overlay:not([hidden]) { display: flex; }

.confirm-modal {
  background: linear-gradient(145deg, rgba(18, 35, 73, 0.98), rgba(10, 24, 54, 0.98));
  border: 1px solid rgba(30, 136, 229, 0.34);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 122, 24, 0.08) inset;
  color: #f5fbff;
  display: grid;
  gap: 18px;
  max-width: 520px;
  padding: 28px;
  width: min(100%, 520px);
}

.confirm-modal-header h2 {
  color: #fff;
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 0;
}

.confirm-modal-message {
  color: #dfe7f5;
  line-height: 1.5;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
}

.confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-button {
  align-items: center;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  justify-content: center;
  min-height: 48px;
  min-width: 128px;
  padding: 0 22px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.confirm-modal-button:hover:not(:disabled),
.confirm-modal-button:focus-visible:not(:disabled) {
  outline: none;
  transform: translateY(-1px);
}

.confirm-modal-cancel {
  background: rgba(13, 24, 51, 0.88);
  border: 1px solid rgba(30, 136, 229, 0.5);
  color: #eef6ff;
}

.confirm-modal-cancel:hover:not(:disabled),
.confirm-modal-cancel:focus-visible:not(:disabled) {
  border-color: rgba(30, 136, 229, 0.9);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.18), 0 12px 24px rgba(0, 0, 0, 0.26);
}

.confirm-modal-danger {
  background: linear-gradient(135deg, rgba(190, 45, 45, 0.94), rgba(255, 122, 24, 0.84));
  border: 1px solid rgba(255, 186, 150, 0.74);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.confirm-modal-danger:hover:not(:disabled),
.confirm-modal-danger:focus-visible:not(:disabled) {
  border-color: rgba(255, 224, 204, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.18), 0 12px 24px rgba(255, 82, 82, 0.16);
}

.confirm-modal-primary {
  background: linear-gradient(135deg, var(--poly-primary), var(--talk-primary));
  border: 1px solid rgba(128, 213, 255, 0.76);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.confirm-modal-primary:hover:not(:disabled),
.confirm-modal-primary:focus-visible:not(:disabled) {
  border-color: rgba(211, 244, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.18), 0 12px 24px rgba(29, 169, 255, 0.16);
}

@media (max-width: 520px) {
  .confirm-modal { padding: 22px; }
  .confirm-modal-actions { justify-content: stretch; }
  .confirm-modal-button { flex: 1 1 100%; }
}

/* Overlay backdrop and flex-centering for tab-share confirmation modal.
   z-index: 1001 places it above .site-notice (also z-index: 1000). */
.tab-share-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1001;
  justify-content: center;
  align-items: center;
}

/* Shows overlay when visible (removes hidden attribute). */
.tab-share-modal-overlay:not([hidden]) {
  display: flex;
}

/* Card container for the tab-share confirmation dialog. */
.tab-share-modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: calc(100% - 48px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header section of the tab-share modal. */
.tab-share-header {
  text-align: center;
  margin-bottom: 20px;
}

.tab-share-header h2 {
  color: #f5fbff;
  font-size: 1.4rem;
  margin: 0;
}

/* Body content area (icon + message). */
.tab-share-body {
  text-align: center;
  color: white;
  padding: 10px 0;
}

/* Centered container for the muted speaker icon. */
.tab-share-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

/* Main instruction text telling user to mute the tab before clicking OK. */
.tab-share-info {
  font-size: 1rem;
  line-height: 1.6;
  color: #e0e0e0;
  margin-bottom: 12px;
}

/* Subtle action hint below the main instruction. */
.tab-share-message {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #a0a0a0;
  margin: 0;
}

/* Footer container with centered OK button and top border separator. */
.tab-share-footer {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* OK button style for pre-share tab popup. */
.btn.tab-share-ok {
  background: linear-gradient(135deg, var(--poly-primary), var(--talk-primary));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

/* Hover effect for the OK button (lift + shadow). */
.btn.tab-share-ok:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--poly-primary-glow);
}

/* Native <dialog> version of confirm modals — support page only */
.confirm-modal-dialog {
  background: transparent;
  border: none;
  box-shadow: none;
  inset: 0;
  padding: 0;
}
.confirm-modal-dialog:modal,
.confirm-modal-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  padding: 24px;
  box-sizing: border-box;
}
.confirm-modal-dialog:modal .confirm-modal,
.confirm-modal-dialog[open] .confirm-modal {
  max-width: 520px;
  width: 100%;
  box-sizing: border-box;
}
.confirm-modal-dialog::backdrop,
.confirm-modal-dialog::-webkit-backdrop {
  background: rgba(2, 6, 18, 0.76);
}

.change-password-form {
  display: grid;
  gap: 12px;
}

.change-password-form .settings-field {
  margin: 0;
}

.change-password-forgot {
  margin: 0;
  text-align: right;
}

.change-password-forgot a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: underline;
}

.change-password-forgot a:hover {
  color: var(--text-primary);
}

.confirm-modal-body {
  display: grid;
  gap: 12px;
}

.confirm-modal-message.is-error {
  color: #ff6b6b;
  font-weight: 500;
}

.confirm-modal-message.is-success {
  color: #51cf66;
  font-weight: 500;
}

/* ── Feedback toast notification ─────────────────────────────── */

.feedback-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 10004;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(16, 185, 129, 0.95));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease, transform 250ms ease;
  backdrop-filter: blur(8px);
  max-width: calc(100vw - 40px);
}

.feedback-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.feedback-toast-icon {
  font-size: 18px;
  font-weight: 700;
}

.feedback-toast-icon::before {
  content: "\2713";
}

.feedback-toast-message {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feedback-toast-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 150ms;
  flex-shrink: 0;
}

.feedback-toast-dismiss:hover {
  color: #fff;
}

@media (max-width: 640px) {
  .feedback-toast {
    top: var(--safe-top);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: auto;
    max-width: calc(100vw - 32px);
    padding: 10px 14px;
    gap: 8px;
    font-size: 13px;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12);
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .feedback-toast.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }

  .feedback-toast-icon {
    font-size: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 1;
  }

  .feedback-toast-message {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  .feedback-toast-dismiss {
    font-size: 16px;
    padding: 4px 6px;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
  }
}

/* ── End-of-session feedback modal ─────────────────────────────── */

.feedback-modal-overlay {
  align-items: center;
  background: rgba(2, 6, 18, 0.76);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 1003;
}

.feedback-modal-overlay:not([hidden]) {
  display: flex;
}

.feedback-modal {
  background: linear-gradient(145deg, rgba(18, 35, 73, 0.98), rgba(10, 24, 54, 0.98));
  border: 1px solid rgba(255, 122, 24, 0.34);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 122, 24, 0.08) inset;
  color: #f5fbff;
  display: grid;
  gap: 18px;
  max-width: 460px;
  padding: 28px;
  width: min(100%, 460px);
}

.feedback-modal-header h2 {
  color: #fff;
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 0;
}

.feedback-modal-desc {
  color: #dfe7f5;
  line-height: 1.5;
  margin: 0;
}

/* Star rating fieldset */
.feedback-star-rating {
  border: none;
  margin: 0;
  padding: 0;
}

.feedback-star-rating legend {
  color: var(--poly-primary);
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feedback-stars {
  display: inline-flex;
  gap: 6px;
}

.feedback-star {
  background: none;
  border: 2px solid rgba(255, 122, 24, 0.28);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 4px 6px;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.feedback-star::before {
  content: "\2605";
}

.feedback-star:hover,
.feedback-star:focus-visible {
  color: #ffd59a;
  border-color: rgba(255, 122, 24, 0.6);
  transform: scale(1.12);
  box-shadow: 0 0 10px rgba(255, 122, 24, 0.25);
}

.feedback-star.is-selected {
  color: #ffa726;
  border-color: rgba(255, 167, 38, 0.65);
}

.feedback-star.is-selected:hover {
  color: #ff9800;
  transform: scale(1.08);
}

.feedback-star-label {
  color: #a8b8cc;
  font-size: 0.8rem;
  margin: 6px 0 0;
  min-height: 1.2em;
}

/* Comment textarea */
.feedback-comment-field {
  display: grid;
  gap: 6px;
}

.feedback-comment-field span {
  color: #e0e0e0;
  font-size: 0.875rem;
  font-weight: 700;
}

.feedback-comment-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 122, 24, 0.32);
  border-radius: 10px;
  background: rgba(13, 24, 51, 0.72);
  color: #eef4ff;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-comment-field textarea:focus-visible {
  border-color: rgba(30, 136, 229, 0.78);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.18);
}

.feedback-char-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  justify-self: end;
}

/* Status messages inside feedback modal */
.feedback-modal-status {
  color: #a8b8cc;
  font-size: 0.875rem;
  margin: 0;
}

.feedback-modal-status.is-error {
  color: #ff6b6b;
  font-weight: 500;
}

.feedback-modal-status.is-success {
  color: #51cf66;
  font-weight: 500;
}

/* Action buttons */
.feedback-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.feedback-modal-button {
  align-items: center;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  min-width: 110px;
  padding: 0 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.feedback-modal-button:hover:not(:disabled),
.feedback-modal-button:focus-visible:not(:disabled) {
  outline: none;
  transform: translateY(-1px);
}

.feedback-modal-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

.feedback-modal-skip {
  background: rgba(13, 24, 51, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.28);
  color: #cdd5e4;
}

.feedback-modal-skip:hover:not(:disabled) {
  border-color: rgba(226, 232, 240, 0.48);
  color: #e8edf8;
}

.feedback-modal-primary {
  background: linear-gradient(135deg, var(--poly-primary), var(--talk-primary));
  border: 1px solid rgba(128, 213, 255, 0.76);
  color: #fff;
}

.feedback-modal-primary:hover:not(:disabled) {
  border-color: rgba(211, 244, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.18), 0 12px 24px rgba(29, 169, 255, 0.16);
}

/* Mobile adjustments */
@media (max-width: 520px) {
  .feedback-modal {
    padding: 22px;
  }

  .feedback-modal-actions {
    justify-content: stretch;
  }

  .feedback-modal-button {
    flex: 1 1 100%;
  }

  .feedback-star {
    font-size: 24px;
    padding: 3px 4px;
  }
}
