:root{
  /* Dark dev theme */
  --bg: #0b0f14;            /* app background */
  --card: #111827;          /* card surfaces (slate) */
  --text: #e5e7eb;          /* primary text */
  --muted: rgba(229,231,235,0.72);

  --bar: #121a24;           /* header/footer base (not pure black) */
  --bar2: #0f1722;          /* gradient companion */
  --barText: #f3f4f6;

  --stroke: rgba(255,255,255,0.10);
  --shadow: 0 10px 26px rgba(0,0,0,0.40);
  --radius: 14px;

  --btn: #0ea5e9;           /* accent (sky) */
  --btnText: #061018;
  --danger: #ef4444;

  --chipBg: rgba(255,255,255,0.08);
  --chipStroke: rgba(255,255,255,0.12);
}

/* Optional: make form controls match dark mode */
:root { color-scheme: dark; }

* { box-sizing: border-box; }

/* Prevent text selection in the UI except inputs */
* {
  user-select: none;
  -webkit-user-select: none;
}
input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

/* --- Android/Samsung PWA viewport fix --- */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* prevent phantom scroll */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* App layout */
.app {
  height: 100dvh;              /* dynamic viewport height */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header (not pure black) */
.header {
  background: linear-gradient(180deg, var(--bar) 0%, var(--bar2) 100%);
  color: var(--barText);
  padding:
    calc(env(safe-area-inset-top) + 10px)
    14px
    10px
    14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  border-bottom: 1px solid var(--stroke);
  z-index: 50;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.header-title h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title .sub {
  font-size: 0.78rem;
  color: rgba(243,244,246,0.70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.55);
}
.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.5);
}
.chip {
  background: var(--chipBg);
  border: 1px solid var(--chipStroke);
  color: rgba(243,244,246,0.92);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.notify-icon {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
}
.notify-icon svg { width: 20px; height: 20px; fill: currentColor; }
.notify-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.25);
}

/* Content: ONLY scrollable area */
.content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

/* Footer (tab bar) */
.footer {
  background: rgba(17,24,39,0.86); /* slightly translucent slate */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border-top: 1px solid var(--stroke);
  padding:
    8px
    10px
    calc(8px + env(safe-area-inset-bottom))
    10px;
  z-index: 50;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 980px;
  margin: 0 auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
}
.tab:active { transform: translateY(1px); }
.tab.active {
  background: rgba(14,165,233,0.20); /* accent tint */
  border-color: rgba(14,165,233,0.45);
  color: var(--barText);
}
.tab svg { width: 18px; height: 18px; fill: currentColor; }

/* Cards */
.card {
  background: linear-gradient(180deg, rgba(17,24,39,0.98) 0%, rgba(17,24,39,0.92) 100%);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;

  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 10px 0;
  font-size: 1.02rem;
}

/* Frame preview */
.frame-preview {
  text-align: center;
}
.frame-preview img {
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: 12px;
  background: #0b0f14;
  border: 1px solid var(--stroke);
}
.hint {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Buttons & inputs */
button {
  border: none;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;

  background: var(--btn);
  color: var(--btnText);
  box-shadow: 0 10px 24px rgba(14,165,233,0.12);
  transition: transform 0.06s ease, filter 0.12s ease;
}
button:hover { filter: brightness(1.03); }
button:active { transform: translateY(1px); }

button.secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}
button.secondary:hover { background: rgba(255,255,255,0.08); }

button.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 24px rgba(239,68,68,0.10);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}

input[type="file"] { max-width: 100%; color: var(--text); }

input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  font-size: 1rem;

  background: rgba(255,255,255,0.04);
  color: var(--text);
}
input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  font-size: 1rem;

  background: rgba(255,255,255,0.04);
  color: var(--text);
}
#gen-prompt {
  flex: 1 1 280px;
  min-width: 220px;
}
label { font-size: 0.85rem; color: var(--muted); display:block; margin-bottom: 6px; }

.status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}
#upload-status { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Gallery list */
.gallery-list {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 12px;
}
.gallery-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
.gallery-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  align-self: center;
}
.image-title {
  font-size: 0.9rem;
  color: var(--text);
  max-width: 160px;
  text-align: right;
  word-break: break-word;
}
.image-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  overflow: visible;
}
.image-row-left .checkbox {
  order: -1;
  margin-right: 2px;
}
.checkbox { width: 18px; height: 18px; accent-color: var(--btn); }
.thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #0b0f14;
  border: 1px solid var(--stroke);
  flex-shrink: 0;
}
.gallery-item.is-hidden {
  filter: grayscale(1);
  opacity: 0.65;
}

.thumb.is-current {
  outline: 2px solid #22c55e;
  outline-offset: 3px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.link-button {
  background: none;
  border: none;
  color: rgba(229,231,235,0.8);
  font-size: 0.82rem;
  padding: 4px 2px;
  cursor: pointer;
  text-decoration: underline;
}
.link-button:hover { color: #fff; }

.gen-fallback {
  margin-top: 6px;
}

.voice-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(15,23,34,0.95), rgba(8,12,18,0.98));
  z-index: 200;
}
.voice-overlay.active { display: flex; }

.voice-panel {
  text-align: center;
  padding: 24px;
  position: relative;
}

.voice-orb {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(14,165,233,0.9), rgba(14,165,233,0.2));
  box-shadow: 0 0 60px rgba(14,165,233,0.35);
  margin: 0 auto 18px;
  position: relative;
  transform: translateZ(0);
  display: none;
}

.voice-orb::before,
.voice-orb::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid rgba(14,165,233,0.35);
  opacity: 0;
}

.voice-orb-core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.15), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.08);
}

.voice-overlay.listening .voice-orb {
  animation: voice-breathe 1.6s ease-in-out infinite;
}

.voice-overlay.listening .voice-orb::before {
  animation: voice-pulse 1.6s ease-out infinite;
}

.voice-overlay.listening .voice-orb::after {
  animation: voice-pulse 1.6s ease-out 0.4s infinite;
}

.voice-overlay.processing .voice-orb {
  animation: none;
  opacity: 0.6;
}

.voice-status {
  font-size: 1rem;
  color: #e5e7eb;
  margin-bottom: 6px;
  display: none;
}


.voice-countdown {
  font-size: 0.9rem;
  color: rgba(229,231,235,0.75);
  min-height: 20px;
}

.voice-overlay.listening .voice-orb,
.voice-overlay.listening .voice-status,
.voice-overlay.no-speech .voice-orb,
.voice-overlay.no-speech .voice-status,
.voice-overlay.detected .voice-orb,
.voice-overlay.detected .voice-status {
  display: block;
}

.voice-overlay.no-speech .voice-status {
  display: block;
  color: #fca5a5;
  font-weight: 700;
}

.voice-confirm {
  margin-top: 10px;
}
.voice-confirm-text {
  font-size: 0.9rem;
  color: rgba(229,231,235,0.8);
  margin-top: 10px;
}
.voice-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.voice-actions .confirm {
  background: #22c55e;
  color: #0b1214;
  box-shadow: 0 10px 24px rgba(34,197,94,0.18);
}
.voice-actions .confirm:hover { filter: brightness(1.05); }
.voice-spinner {
  width: 36px;
  height: 36px;
  margin: 16px auto 10px;
  border-radius: 50%;
  border: 3px solid rgba(229,231,235,0.2);
  border-top-color: #0ea5e9;
  animation: spin 1s linear infinite;
  display: none;
}

.voice-overlay.processing .voice-spinner { display: block; }

.voice-fallback {
  margin-top: 10px;
}

.voice-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15,23,34,0.6);
  color: #e5e7eb;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.voice-close:hover { filter: brightness(1.08); }

@keyframes voice-breathe {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes voice-pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.toolbar button { font-size: 0.84rem; padding: 0.45rem 0.75rem; }
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
}
.gallery-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}
.filter-group {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
}
.filter-pill {
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  color: rgba(229,231,235,0.75);
  cursor: pointer;
  font-size: 0.82rem;
}
.filter-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.filter-pill:focus {
  outline: 2px solid rgba(14,165,233,0.4);
  outline-offset: 1px;
}
.filter-pill.is-active {
  background: rgba(14,165,233,0.25);
  color: var(--barText);
  border: 1px solid rgba(14,165,233,0.45);
}
.sort-toggle {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
}
.gallery-search {
  display: inline-flex;
  align-items: center;
}
.gallery-search input {
  width: min(240px, 52vw);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.gallery-search input:focus {
  outline: 2px solid rgba(14,165,233,0.4);
  outline-offset: 1px;
}
.gallery-search input:disabled { opacity: 0.5; }
.overflow-button {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
}
.overflow-menu {
  position: absolute;
  right: 0;
  top: auto;
  bottom: calc(100% + 8px);
  background: rgba(17,24,39,0.98);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  z-index: 120;
  min-width: 160px;
  display: grid;
  gap: 6px;
}
.overflow-menu button {
  width: 100%;
  justify-content: center;
}
.selection-bar {
  position: sticky;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin: 6px 0 10px;
  border-radius: 12px;
  background: rgba(15,23,34,0.92);
  border: 1px solid rgba(14,165,233,0.35);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  z-index: 5;
}
.selection-left,
.selection-actions,
.selection-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.selection-count {
  font-weight: 600;
  color: var(--barText);
}
.inline-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.gallery-card h2 { margin-bottom: 6px; }
.gallery-item.is-selected {
  border-color: rgba(14,165,233,0.6);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.2), 0 10px 20px rgba(14,165,233,0.12);
}
.thumb-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(229,231,235,0.85);
  background: rgba(255,255,255,0.04);
}
.status-badge.on-frame {
  border-color: rgba(34,197,94,0.55);
  color: #a7f3d0;
}
.status-badge.hidden {
  border-color: rgba(239,68,68,0.45);
  color: #fecaca;
}
.status-badge.new {
  border-color: rgba(14,165,233,0.55);
  color: #bae6fd;
}
.gallery-empty {
  text-align: center;
  padding: 24px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
}
.skeleton-card {
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  height: 110px;
}
.skeleton-thumb {
  width: 96px;
  height: 72px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
}
.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  margin-top: 8px;
  width: 70%;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.status.is-loading {
  position: relative;
  padding-left: 20px;
}
.status.is-loading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(229,231,235,0.2);
  border-top-color: #0ea5e9;
  animation: spin 1s linear infinite;
}

.toolbar-gallery {
  justify-content: space-between;
}

@media (max-width: 560px) {
  .gallery-item { grid-template-columns: minmax(0, 1fr) auto; }
  .row {
    width: 100%;
    justify-content: flex-end;
  }
  .gallery-controls { width: 100%; }
  .gallery-actions { width: 100%; justify-content: flex-end; }
  .gallery-meta { align-items: flex-end; }
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Slideshow controls */
.slideshow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  height: 44px;
}
.toggle-row input { transform: scale(1.15); accent-color: var(--btn); }

.settings-divider {
  height: 1px;
  background: var(--stroke);
  margin: 18px 0;
  opacity: 0.7;
}

.admin-token .row {
  gap: 10px;
}
.admin-token input {
  flex: 1;
}

.slideshow-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}
.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  background: rgba(14,165,233,0.28);
  border: 1px solid rgba(14,165,233,0.55);
  color: var(--barText);
  box-shadow: 0 10px 24px rgba(14,165,233,0.10);
  transition: transform 0.06s ease, filter 0.12s ease;
  padding: 0;
}
.icon-button:hover { filter: brightness(1.05); }
.icon-button:active { transform: translateY(1px); }

.icon-button.secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 24px rgba(0,0,0,0.20);
}
.icon-button svg { width: 24px; height: 24px; fill: currentColor; }

/* Screens */
.screen { display: none; }
.screen.active { display: block; }

#connect-card {
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.06);
}

.voice-orb-cross {
  position: absolute;
  inset: 40px;
  display: none;
}
.voice-orb-cross::before,
.voice-orb-cross::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 6px;
  background: #ef4444;
  border-radius: 999px;
  transform-origin: center;
}
.voice-orb-cross::before { transform: translate(-50%, -50%) rotate(45deg); }
.voice-orb-cross::after { transform: translate(-50%, -50%) rotate(-45deg); }

.voice-overlay.no-speech .voice-orb {
  background: radial-gradient(circle at 30% 30%, rgba(239,68,68,0.9), rgba(14,165,233,0.25));
  box-shadow: 0 0 60px rgba(239,68,68,0.35);
}
.voice-overlay.no-speech .voice-orb-cross { display: block; }

.voice-overlay.detected .voice-orb {
  background: radial-gradient(circle at 30% 30%, rgba(34,197,94,0.9), rgba(14,165,233,0.2));
  box-shadow: 0 0 60px rgba(34,197,94,0.35);
}
.voice-overlay.detected .voice-orb::before,
.voice-overlay.detected .voice-orb::after {
  display: none;
}
.voice-orb-check {
  position: absolute;
  inset: 52px;
  display: none;
  color: #22c55e;
  filter: drop-shadow(0 2px 6px rgba(34,197,94,0.35));
}
.voice-overlay.detected .voice-orb-check { display: block; }


.toast-container {
  position: fixed;
  top: calc(var(--header-height, 0px) + 14px);
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.pip-card {
  position: fixed;
  right: 18px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(360px, 92vw);
  background: rgba(17,24,39,0.98);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 220;
  will-change: transform;
}
.pip-card.active { display: block; }
.pip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--stroke);
  cursor: move;
  user-select: none;
  touch-action: none;
}
.pip-header span {
  font-size: 0.9rem;
  font-weight: 600;
}
.pip-close {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pip-body {
  padding: 10px;
}
.pip-body img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #0b0f14;
}

.toast {
  background: rgba(17,24,39,0.95);
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 220px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast .toast-text {
  font-size: 0.88rem;
  line-height: 1.2;
}

.toast .toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 1rem;
  cursor: pointer;
}

.notify-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,10,16,0.55);
  display: none;
  z-index: 180;
}
.notify-backdrop.active { display: block; }

.notify-panel {
  position: fixed;
  top: calc(var(--header-height, 0px) + 14px);
  right: 10px;
  width: 320px;
  max-width: calc(100vw - 20px);
  height: calc(100dvh - var(--header-height, 0px) - 14px - env(safe-area-inset-bottom));
  background: rgba(17,24,39,0.98);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(120%);
  transition: transform 0.18s ease;
  z-index: 200;
}
.notify-panel.active { transform: translateX(0); }
.notify-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
}
.notify-title {
  font-size: 0.92rem;
  font-weight: 600;
}
.notify-actions {
  display: flex;
  gap: 6px;
}
button.small {
  padding: 6px 10px;
  font-size: 0.78rem;
}
.notify-list {
  padding: 8px 10px 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notify-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 2px;
}
.notify-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 6px 10px;
  align-items: center;
  position: relative;
}
.notify-item.unread {
  border-color: rgba(239,68,68,0.35);
}
.notify-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.15);
  grid-row: span 2;
  align-self: start;
  margin-top: 4px;
}
.notify-item:not(.unread) .notify-unread-dot { opacity: 0; }
.notify-item.success { border-color: rgba(34,197,94,0.35); }
.notify-item.error { border-color: rgba(239,68,68,0.35); }
.notify-message {
  font-size: 0.88rem;
  color: #e5e7eb;
  grid-column: 2 / 3;
}
.notify-meta {
  font-size: 0.76rem;
  color: var(--muted);
  grid-column: 2 / -1;
}
.notify-mark-read {
  background: transparent;
  border: none;
  color: #22c55e;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  grid-column: 3 / 4;
}
.notify-mark-read svg { width: 16px; height: 16px; }
.notify-mark-read:disabled {
  opacity: 0.35;
  cursor: default;
}
.notify-delete {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 1rem;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
  grid-column: 4 / 5;
  justify-self: end;
}
.notify-delete:hover { color: #fca5a5; }
.notify-item:hover .notify-delete { opacity: 1; }
