/* ==========================================================================
   X Appeal Helper — Mobile-First Stylesheet (360px baseline, >= 44px tap targets)
   ========================================================================== */

:root {
  --bg-page: #f1f5f9;
  --bg-shell: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-code: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #0f1419;
  --accent-hover: #272c30;
  --accent-blue: #1d9bf0;
  --accent-blue-dark: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-soft-text: #0369a1;

  --success-bg: #dcfce7;
  --success-text: #166534;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --warning-border: #fcd34d;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --error-border: #fca5a5;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --header-height: 60px;
  --nav-height: 64px;
  --shell-max: 480px;
}

[data-theme="dark"] {
  --bg-page: #06090f;
  --bg-shell: #0b111a;
  --bg-surface: #131c28;
  --bg-surface-subtle: #1a2636;
  --bg-code: #0d1520;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border: #223044;
  --border-strong: #334661;

  --accent: #1d9bf0;
  --accent-hover: #38a8f5;
  --accent-blue: #38bdf8;
  --accent-blue-dark: #7dd3fc;
  --accent-soft: rgba(29, 155, 240, 0.16);
  --accent-soft-text: #7dd3fc;

  --success-bg: rgba(34, 197, 94, 0.18);
  --success-text: #86efac;
  --warning-bg: rgba(245, 158, 11, 0.18);
  --warning-text: #fde68a;
  --warning-border: rgba(245, 158, 11, 0.45);
  --error-bg: rgba(239, 68, 68, 0.18);
  --error-text: #fca5a5;
  --error-border: rgba(239, 68, 68, 0.45);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Focus visibility for accessibility */
:focus-visible {
  outline: 2.5px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ==========================================================================
   App Shell & Header
   ========================================================================== */

.app-shell {
  width: 100%;
  max-width: var(--shell-max);
  min-height: 100dvh;
  margin: 0 auto;
  background-color: var(--bg-shell);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 520px) {
  .app-shell {
    box-shadow: var(--shadow-md);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-height);
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #0f1419;
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(126, 34, 206, 0.25);
}

.brand-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text {
  min-width: 0;
}

.app-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-subtitle {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Main Content & Cards
   ========================================================================== */

.main-content {
  flex: 1;
  padding: 14px 14px calc(var(--nav-height) + 28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.offline-banner[hidden] {
  display: none;
}

.offline-banner svg {
  flex-shrink: 0;
}

.install-banner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--accent-blue);
}

.install-banner[hidden] {
  display: none;
}

.install-banner-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.install-banner-text {
  flex: 1;
  min-width: 0;
}

.install-banner-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
}

.install-banner-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.icon-dismiss-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -6px -8px -6px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-dismiss-btn:active {
  background: var(--bg-surface-subtle);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tab-panel[hidden] {
  display: none;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 46px 12px 14px;
  font-size: 16px; /* >= 16px prevents iOS Safari auto-zoom */
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.url-input::placeholder {
  color: var(--text-muted);
  font-size: 14.5px;
}

.url-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.18);
}

.input-clear-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
}

.input-clear-btn:active {
  background: var(--border);
}

.field-helper {
  margin: 8px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.field-helper code {
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.input-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
}

/* ==========================================================================
   Buttons (ALL >= 44px min-height for mobile ergonomics)
   ========================================================================== */

.btn {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue-dark);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: var(--accent-soft);
  border-color: var(--accent-blue);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-color: transparent;
}

.btn-sm {
  min-height: 44px;
  min-width: 60px;
  padding: 8px 14px;
  font-size: 13.5px;
}

.btn-block {
  width: 100%;
}

.icon-square-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-square-btn:active {
  transform: scale(0.95);
  background: var(--bg-surface-subtle);
}

.chip-btn {
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.chip-btn.saved {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: transparent;
}

.mt-12 {
  margin-top: 12px;
}

/* ==========================================================================
   Alerts & Badges
   ========================================================================== */

.alert {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

/* ==========================================================================
   Empty State & Result Cards
   ========================================================================== */

.empty-guide-card {
  text-align: left;
  padding: 20px 16px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 700;
}

.empty-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.mini-feature-list {
  margin: 14px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-feature-list code {
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.result-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.parsed-meta-card {
  padding: 14px 16px;
}

.meta-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: var(--bg-surface-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.meta-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.meta-item dt {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.meta-item dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  overflow-wrap: anywhere;
}

.link-card-primary {
  border: 1.5px solid var(--accent-blue);
}

.link-card-repaired {
  border: 1.5px solid var(--warning-border);
}

.link-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.link-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.link-card-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.url-preview-box {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  word-break: break-all;
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}

.link-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 420px) {
  .link-card-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }
}

.section-mini-title {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
}

.section-mini-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.alt-link-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alt-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
}

.alt-link-info {
  min-width: 0;
  flex: 1;
}

.alt-link-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}

.alt-link-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.alt-link-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==========================================================================
   Templates Tab
   ========================================================================== */

.panel-intro,
.panel-intro-row {
  padding: 2px 2px 0;
}

.panel-intro-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.panel-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.active-post-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 12.5px;
  font-weight: 600;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  flex-shrink: 0;
}

.pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
}

.template-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  min-width: 0;
  flex: 1 1 180px;
}

.template-body {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-primary);
}

/* ==========================================================================
   History Tab
   ========================================================================== */

.text-danger-btn {
  min-height: 44px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--error-text);
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.history-user {
  font-size: 14.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-delete-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px 0 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.history-delete-btn:active {
  background: var(--error-bg);
  color: var(--error-text);
}

.status-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.status-opt-btn {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.status-opt-btn.active[data-status="pending"] {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.status-opt-btn.active[data-status="submitted"] {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-color: var(--accent-blue);
}

.status-opt-btn.active[data-status="resolved"] {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: transparent;
}

.history-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==========================================================================
   Guide Tab (Accordions)
   ========================================================================== */

.guide-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-accordion {
  padding: 0;
  overflow: hidden;
}

.guide-summary {
  list-style: none;
  min-height: 56px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.guide-summary::-webkit-details-marker {
  display: none;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.guide-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.guide-accordion .chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.guide-accordion[open] .chevron {
  transform: rotate(180deg);
}

.guide-body {
  padding: 0 16px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.guide-body p {
  margin: 12px 0 0;
}

.guide-body code {
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.step-list,
.bullet-list {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-quick-links {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-footnote {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Bottom Navigation Bar (Fixed, Touch-Friendly >= 56px)
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell-max);
  min-height: var(--nav-height);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-surface) 95%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 30;
}

.nav-item {
  min-height: 52px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
  color: var(--accent-blue-dark);
  background: var(--accent-soft);
}

[data-theme="dark"] .nav-item.active {
  color: var(--accent-blue);
}

.nav-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.nav-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-blue);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-badge[hidden] {
  display: none;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 420px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  z-index: 40;
  animation: toastFadeIn 0.18s ease-out;
}

[data-theme="dark"] .toast {
  background: #e2e8f0;
  color: #0f172a;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ==========================================================================
   Author Info Card & Footer
   ========================================================================== */

.author-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.author-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #0f1419;
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

[data-theme="dark"] .author-avatar {
  background: var(--accent-soft);
  color: var(--accent-blue);
}

.author-meta {
  min-width: 0;
  flex: 1;
}

.author-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.author-name {
  margin: 1px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.author-handle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.app-footer {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  justify-content: center;
}

.footer-author-link {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.footer-author-link strong {
  color: var(--text-secondary);
  font-weight: 700;
}

.footer-author-link:hover,
.footer-author-link:active {
  background: var(--bg-surface);
  color: var(--accent-blue-dark);
}

.footer-handle {
  font-size: 11.5px;
  opacity: 0.85;
}

/* ==========================================================================
   Random Top Hero Banner Card
   ========================================================================== */

.hero-banner-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #9333ea 28%, var(--border));
  background: var(--bg-surface);
}

.hero-banner-media-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: #0f1419;
  cursor: pointer;
  aspect-ratio: 1024 / 571;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hero-banner-media-btn:active .hero-banner-img {
  transform: scale(0.99);
}

.hero-banner-img.is-swapping {
  opacity: 0.35;
}

.hero-banner-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.hero-banner-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.hero-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9333ea;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.16);
  flex-shrink: 0;
}

.hero-stage-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-shuffle-btn {
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #7e22ce;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

[data-theme="dark"] .hero-shuffle-btn {
  color: #c084fc;
}

.hero-shuffle-btn:active {
  background: rgba(147, 51, 234, 0.12);
}
