/* Layout */
.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.2s ease, opacity 0.2s ease;
}

.sidebar.collapsed {
  margin-left: -280px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle {
  padding: 2px 10px !important;
  font-size: 14px;
  line-height: 1;
  min-width: auto !important;
  letter-spacing: 0.3px;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-mascot {
  width: 40px;
  height: auto;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 0;
}

.user-info {
  font-size: 11px;
  color: var(--text-dim);
}

.user-info a {
  color: var(--accent-dim);
  text-decoration: none;
  margin-left: 6px;
}

.user-info a:hover { text-decoration: underline; }

.game-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.date-separator {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 10px 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.game-item {
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: background 0.15s;
}

.game-item:hover {
  background: var(--bg-card-hover);
}

.game-item.active {
  background: var(--bg-card-hover);
  border-color: var(--accent-dim);
}

.game-item .date {
  font-size: 12px;
  color: var(--text);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar label {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.toolbar input[type="checkbox"] {
  accent-color: var(--accent);
}
.toolbar-menu {
  position: relative;
}
.toolbar-menu-btn {
  font-size: 18px;
  padding: 4px 8px;
  line-height: 1;
}
.toolbar-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.toolbar-menu.open .toolbar-dropdown {
  display: block;
}
.toolbar-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.toolbar-dropdown button:hover {
  background: rgba(255,255,255,0.05);
}

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: var(--bg-card-hover); }
.btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-primary:hover { background: var(--accent); color: #000; }
.btn-delete { font-size: 11px; padding: 2px 10px; color: var(--sev-major); border-color: var(--sev-major); margin-left: 12px; vertical-align: middle; }
.btn-delete:hover { background: var(--sev-major); color: #fff; }

.spacer { flex: 1; }

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 15px;
}

.onboarding {
  max-width: 560px;
  margin: 80px auto;
  padding: 0 24px;
}
.onboarding h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.onboarding h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 500;
  margin: 24px 0 12px;
  color: var(--text);
}
.onboarding p {
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 8px;
}
.onboarding code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  word-break: break-all;
}
.onboarding ol {
  padding-left: 24px;
  color: var(--text-dim);
  line-height: 1.8;
}
.onboarding ol li {
  padding-left: 4px;
}
.onboarding a {
  color: var(--accent);
  text-decoration: none;
}
.onboarding a:hover {
  text-decoration: underline;
}
.onboarding .btn {
  margin-top: 24px;
}
.onboarding-sub {
  list-style: disc;
  padding-left: 20px;
  margin-top: 4px;
  line-height: 1.6;
}
.onboarding-video {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 12px 0 16px;
  border-radius: 6px;
  background: #000;
}

/* Tutorial tabs (Tenhou / Mahjong Soul video switcher in the onboarding
   empty state and the Add-Game modal bookmarklet section). */
.tutorial-tabs-wrap { margin: 12px 0 16px; }
.tutorial-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
}
.tutorial-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tutorial-tab:hover { color: var(--text); }
.tutorial-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tutorial-video { display: none; margin-top: 12px; }
.tutorial-video.active { display: block; }

/* Account page */
.account-section {
  max-width: 400px; padding: 16px;
  background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border);
}
.account-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.account-row:last-child { border-bottom: none; }
.account-label { font-size: 13px; color: var(--text-dim); min-width: 80px; }
.account-linked { font-size: 13px; color: var(--success); }
.account-btn {
  font-size: 12px; padding: 4px 10px; border-radius: 4px; cursor: pointer;
  background: var(--bg-main); color: var(--text); border: 1px solid var(--border);
}
.account-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-width: 90vw;
}

.modal h3 {
  margin-bottom: 16px;
  color: var(--accent);
}

.modal .form-group {
  margin-bottom: 12px;
}

.modal label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.modal .form-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.4;
}
.modal .form-hint a {
  color: var(--accent);
  text-decoration: none;
}
.modal .form-hint a:hover {
  text-decoration: underline;
}

.modal input, .modal textarea, .modal select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.modal textarea {
  resize: vertical;
  min-height: 80px;
}

.modal .btn-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.add-progress { margin-bottom: 12px; }
.add-progress-text { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.add-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.add-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.modal .error {
  color: var(--sev-major);
  font-size: 13px;
  margin-top: 8px;
}

/* Game view tabs */
.game-tabs {
  display: flex;
  gap: 0;
  margin: 12px 0 16px;
  border-bottom: 2px solid var(--border);
}

.game-tab {
  padding: 8px 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.game-tab:hover {
  color: var(--text);
}

.game-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Trends — mistake panel that links back into the game view. */
.trend-mistakes-panel {
  padding: 0 0 8px;
}
.trend-mistakes-panel .mistake {
  margin: 8px 0;
}
.mistake-date {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
}
.round-label {
  font-size: 11px;
  color: var(--text-dim);
}
.mistake-link {
  font-size: 12px;
  cursor: pointer;
  color: var(--accent);
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  opacity: 0.7;
  text-decoration: none;
}
.mistake-link:hover {
  opacity: 1;
  background: rgba(79, 195, 247, 0.1);
}

/* Trends */
.trend-chart-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.trend-chart-card h3 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 12px;
}

.trend-chart {
  overflow-x: auto;
}

.trend-svg {
  width: 100%;
  height: auto;
}

.trend-down {
  color: var(--sev-minor);
  font-weight: 700;
}

.trend-up {
  color: var(--sev-major);
  font-weight: 700;
}

.trend-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trend-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trend-bar-label {
  font-size: 13px;
  font-weight: 700;
  min-width: 80px;
}

.trend-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.trend-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
  opacity: 0.85;
}

.trend-bar-value {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 210px;
  text-align: right;
}

.trend-bar-primary {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  width: 90px;
  flex: 0 0 90px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trend-bar-breakdown {
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.6;
  width: 240px;
  flex: 0 0 240px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trend-bar-count {
  opacity: 0.6;
}

/* Help page */
.help-group {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.help-group-header {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.help-cat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  flex-wrap: wrap;
}

.help-cat-label {
  font-weight: 600;
  min-width: 90px;
  color: var(--text);
}

.help-cat-desc {
  color: var(--text-dim);
  flex: 1;
  min-width: 200px;
}

.help-cat-study {
  font-size: 11px;
  color: var(--accent-dim);
  white-space: nowrap;
}

.help-section {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 12px;
}

.help-section h3 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
}

.help-section p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  line-height: 1.5;
}

.help-safety-scale {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.help-safety-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.help-safety-bar {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============ Landing page ============ */

.landing-body {
  background: #0d0f1a;
  min-height: 100vh;
  overflow-x: hidden;
}

.landing-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(79,195,247,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(67,160,71,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.landing {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

/* Hero */
.landing-hero {
  text-align: center;
  margin-bottom: 64px;
}

.landing-brand h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 42px;
  color: #e8eaf0;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.landing-tagline {
  font-size: 16px;
  color: #5a6078;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.landing-mascot {
  width: 100px;
  height: auto;
  margin-bottom: 16px;
  animation: landingTileIn 0.5s ease backwards;
}

@keyframes landingTileIn {
  from { opacity: 0; transform: translateY(-10px); }
}

.landing-subtitle {
  font-size: 15px;
  color: #8892a4;
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.landing-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.landing .btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.landing .btn-primary {
  background: linear-gradient(135deg, #2a7aa3 0%, #357a8f 100%);
  color: #fff;
}

.landing .btn-primary:hover {
  background: linear-gradient(135deg, #3a9ac3 0%, #4fc3f7 100%);
  box-shadow: 0 4px 16px rgba(79, 195, 247, 0.25);
}

.landing .btn-secondary {
  background: transparent;
  color: #8892a4;
  border: 1px solid #2a3a5a;
}

.landing .btn-secondary:hover {
  color: #c8ccd8;
  border-color: #4a5a7a;
}

/* Features */
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 56px;
}

.landing-feature {
  background: linear-gradient(160deg, #141828 0%, #111524 100%);
  border: 1px solid #1e2540;
  border-radius: 12px;
  padding: 24px 20px;
  transition: border-color 0.2s;
}

.landing-feature:hover {
  border-color: #2a3a5a;
}

.landing-feature-icon {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  min-height: 36px;
}

.landing-tile-sm {
  height: 34px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid transparent;
}

.landing-tile-sm.landing-tile-glow {
  border-color: #ffa94d;
  box-shadow: 0 0 6px rgba(255, 169, 77, 0.3);
}

.landing-chart-icon {
  width: 48px;
  height: 32px;
}

.landing-feature h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #e0e4ee;
  margin-bottom: 8px;
}

.landing-feature p {
  font-size: 13px;
  color: #6a7090;
  line-height: 1.55;
}

/* Screenshot mock */
.landing-screenshots {
  margin-bottom: 56px;
}
.landing-screenshot {
  margin-bottom: 56px;
}

.landing-screenshot-frame {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e2540;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  position: relative;
}
.landing-real-screenshot {
  width: 100%;
  display: block;
}
.landing-screenshot-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.landing-screenshot-frame.small {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.landing-screenshot-label {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 12px;
  color: #4fc3f7;
  background: rgba(13, 15, 26, 0.8);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Bottom CTA */
.landing-bottom {
  text-align: center;
  margin-bottom: 48px;
}

.landing-bottom p {
  font-size: 14px;
  color: #6a7090;
  margin-bottom: 20px;
}

/* Footer */
.landing-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid #1e2540;
}

.landing-footer p {
  font-size: 12px;
  color: #3a4060;
}

.landing-footer a {
  color: #5a6a90;
  text-decoration: none;
}

.landing-footer a:hover {
  color: #8892a4;
}

/* Admin dashboard */
.admin-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.admin-filters select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.admin-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}

.admin-users-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px 12px 4px 0;
  border-bottom: 1px solid var(--border);
}

.admin-users-table td {
  padding: 4px 12px 4px 0;
}

.admin-users-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.admin-users-table th.sortable:hover {
  color: var(--text);
}

.admin-users-table th.sorted {
  color: var(--text);
}

/* --- Category-shape snapshot panel --- */
.snapshot-note {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0 0 10px;
  line-height: 1.5;
}
.snapshot-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.snapshot-status {
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
}
.snapshot-status-inline {
  font-size: 12px;
  color: var(--text-dim);
}
.snapshot-headline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}
.snapshot-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(220, 70, 70, 0.10);
}
.snapshot-big-num {
  font-size: 30px;
  font-weight: 700;
  color: #e26d6d;
}
.snapshot-big-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.snapshot-headline-meta {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.snapshot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}
.snapshot-table th {
  text-align: right;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--border);
}
.snapshot-table th:first-child,
.snapshot-table td:first-child {
  text-align: left;
}
.snapshot-table td {
  text-align: right;
  padding: 4px 10px 4px 0;
}
.snapshot-row-complex td {
  color: #e26d6d;
  font-weight: 600;
}
.snapshot-matrix,
.snapshot-history {
  margin-top: 10px;
}
.snapshot-matrix > summary,
.snapshot-history > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  user-select: none;
}
.snapshot-history-empty {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 10px;
}
.snapshot-saved {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 8px 0;
}
.snapshot-saved > summary {
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.impersonate-banner {
  background: #5e3b00;
  color: #ffd59a;
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #ffb84d;
  position: sticky;
  top: 0;
  z-index: 50;
}

.impersonate-banner b { color: #fff; }

.impersonate-banner .btn {
  margin-left: auto;
}

/* ============ Mailbox ============ */
.mailbox { position: relative; }
.mailbox-btn {
  padding: 5px 9px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.mailbox-btn svg {
  width: 16px; height: 16px;
  display: block;
  color: var(--text);
}
.mailbox-btn:hover svg { color: var(--accent); }
.mailbox-btn.has-unread svg { color: var(--accent); }
.mailbox-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--sev-major);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  border: 2px solid var(--bg);
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0;
}

.mailbox-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 400px;
  max-height: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(79, 195, 247, 0.04);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: top right;
  animation: mailboxPanelIn 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.mailbox.open .mailbox-panel { display: flex; }
@keyframes mailboxPanelIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mailbox-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mailbox-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}
.mailbox-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 8px;
  gap: 0;
}
.mailbox-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 10px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.2px;
  transition: color 0.15s, border-color 0.15s;
}
.mailbox-tab:hover { color: var(--text); }
.mailbox-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.mailbox-tab .count {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--border);
  color: var(--text-dim);
  min-width: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mailbox-tab.active .count {
  background: rgba(79, 195, 247, 0.18);
  color: var(--accent);
}

.mailbox-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  min-height: 120px;
}
.mailbox-list::-webkit-scrollbar { width: 8px; }
.mailbox-list::-webkit-scrollbar-track { background: transparent; }
.mailbox-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(42, 58, 90, 0.5);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.msg:last-child { border-bottom: none; }
.msg:hover { background: rgba(79, 195, 247, 0.04); }

.msg.unread::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.msg.unread .msg-title { color: var(--text); }
.msg.read .msg-title { color: var(--text-dim); }
.msg.read .msg-meta-tag { opacity: 0.6; }
.msg.read .msg-body { color: var(--text-dim); }

.msg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.msg-meta-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.4;
  flex-shrink: 0;
}
.msg-meta-tag.tag-feature {
  color: var(--accent);
  background: rgba(79, 195, 247, 0.12);
}
.msg-meta-tag.tag-thanks {
  color: var(--sev-flag);
  background: rgba(171, 71, 188, 0.14);
}
.msg-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.msg-title {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.1px;
  line-height: 1.3;
  margin-bottom: 6px;
}
.msg-body {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.55;
}
.msg-body p + p { margin-top: 8px; }

.msg-body ul {
  list-style: none;
  margin-top: 8px;
  padding-left: 0;
}
.msg-body ul li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 4px;
  line-height: 1.5;
}
.msg-body ul li::before {
  content: "";
  position: absolute;
  left: 2px; top: 8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}
.msg.read .msg-body ul li::before { background: var(--text-dim); opacity: 0.5; }

.msg-body blockquote,
.msg-body .quote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 2px solid var(--sev-flag);
  background: rgba(171, 71, 188, 0.06);
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.5;
}
.msg.read .msg-body blockquote,
.msg.read .msg-body .quote {
  border-left-color: var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.msg-body blockquote .quote-attr,
.msg-body .quote .quote-attr {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.3px;
}
.msg-body code {
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.mailbox-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.6;
}
.mailbox-empty svg { opacity: 0.3; margin-bottom: 8px; }
