/* ============================================================
   Canvas — Stylesheet
   Fonts: Cormorant Garamond (display) + DM Mono (body)
   Place WOFF2 files in /fonts/:
     fonts/CormorantGaramond-Regular.woff2
     fonts/CormorantGaramond-Medium.woff2
     fonts/DMMono-Regular.woff2
     fonts/DMMono-Medium.woff2
   ============================================================ */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/CormorantGaramond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/CormorantGaramond-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}


/* ============================================================
   CSS Variables
   ============================================================ */

:root {
  --bg:          #0a0a0f;
  --surface:     #13131a;
  --surface-2:   #1a1a24;
  --border:      #1e1e2e;
  --text:        #e0e0e8;
  --text-muted:  #6b6b80;
  --accent:      #c9a96e;
  --accent-dim:  #8a7048;
  --danger:      #c96e6e;
  --sidebar-w:   260px;
  --toolbar-h:   56px;
  --radius:      6px;
  --transition:  150ms ease;
  --shimmer-1:   #13131a;
  --shimmer-2:   #1f1f2c;
}


/* ============================================================
   Reset & Base
   ============================================================ */

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  line-height: 1.2;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-dim);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

textarea {
  resize: vertical;
}

ul {
  list-style: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--accent-dim);
  color: var(--text);
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   Views
   ============================================================ */

.view {
  width: 100%;
  min-height: 100vh;
}


/* ============================================================
   Login
   ============================================================ */

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 40%, rgba(201,169,110,0.06) 0%, transparent 70%),
    var(--bg);
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: 0 0 0 1px rgba(201,169,110,0.04), 0 24px 48px rgba(0,0,0,0.5);
}

.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 40px rgba(201,169,110,0.3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  padding: 10px 12px;
  width: 100%;
}

.login-error, .lockout-msg {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 12px;
}

#login-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius);
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: opacity var(--transition);
}

#login-btn:hover:not(:disabled) { opacity: 0.85; }
#login-btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* ============================================================
   App Shell
   ============================================================ */

#app-view {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}


/* ============================================================
   Sidebar
   ============================================================ */

#sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.app-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

#sidebar-close {
  display: none;
  color: var(--text-muted);
}

.view-modes {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.view-mode-btn {
  flex: 1;
  padding: 6px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}

.view-mode-btn.active {
  background: var(--surface-2);
  color: var(--accent);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  text-align: left;
  font-size: 12px;
}

.filter-toggle:hover,
.filter-toggle[data-active="true"] {
  background: var(--surface-2);
  color: var(--accent);
}

.heart { font-size: 14px; }

.sidebar-section { margin-top: 12px; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#collection-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.collection-item {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  font-size: 12px;
}

.collection-item:hover,
.collection-item.active {
  background: var(--surface-2);
  color: var(--text);
}

.collection-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-menu-btn {
  opacity: 0;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: opacity var(--transition), color var(--transition);
  letter-spacing: 0.05em;
}

.collection-item:hover .collection-menu-btn,
.collection-menu-btn:focus { opacity: 1; }
.collection-menu-btn:hover { color: var(--text); }

#collection-context-menu {
  position: fixed;
  z-index: 250;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  overflow: hidden;
  min-width: 120px;
}

#collection-context-menu:not([hidden]) {
  display: flex !important;
  flex-direction: column;
}

.col-menu-item {
  padding: 9px 14px;
  font-size: 12px;
  text-align: left;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.col-menu-item:hover { background: var(--surface-2); color: var(--text); }
.col-menu-item.danger:hover { color: var(--danger); }

.collection-rename-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--accent-dim);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 2px 6px;
  outline: none;
  min-width: 0;
}

.collection-child { padding-left: 26px; }

.collection-toggle {
  font-size: 10px;
  padding: 0 4px 0 0;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
  width: 16px;
}

.signout-btn {
  margin-top: auto;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--transition);
  text-align: left;
}

.signout-btn:hover { color: var(--danger); }


/* ============================================================
   Main Area
   ============================================================ */

#main-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

#toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--toolbar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#sidebar-open {
  display: none;
  color: var(--text-muted);
}

.breadcrumb {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--text-muted);
  flex: 1;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#search-input {
  flex: 1;
  padding: 7px 12px;
  font-size: 12px;
}

#search-input:not(:placeholder-shown) { border-color: var(--accent-dim); }

#type-filter,
#sort-select {
  padding: 7px 10px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
}

#type-filter:hover, #type-filter:focus,
#sort-select:hover, #sort-select:focus {
  border-color: var(--accent-dim);
  color: var(--text);
}

#upload-progress:not([hidden]) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

#upload-progress-bar {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

#upload-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 200ms ease;
}


/* ============================================================
   Card Grid
   ============================================================ */

#card-grid {
  padding: 20px;
  flex: 1;
}

/* Gallery mode */
#card-grid[data-view="gallery"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}

/* List mode */
#card-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Masonry mode */
#card-grid[data-view="masonry"] {
  columns: 4 180px;
  gap: 12px;
}

#card-grid[data-view="masonry"] .card-item {
  break-inside: avoid;
  margin-bottom: 12px;
}

/* Empty state + load more */
#empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

#load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 20px;
}


/* ============================================================
   Card Item
   ============================================================ */

.card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  animation: fadeIn 200ms ease both;
}

.card-item:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Image card thumbnail */
.card-thumbnail {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

/* Masonry: natural height */
#card-grid[data-view="masonry"] .card-thumbnail {
  aspect-ratio: unset;
  height: auto;
}

/* Link card OG image */
.card-og-image {
  width: 100%;
  aspect-ratio: 2/1;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

/* Card body */
.card-body {
  padding: 10px 12px;
}

.card-site {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.card-favicon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
}

.card-domain {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.card-desc {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 8px;
}

.card-type-badge {
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-fav-indicator {
  margin-left: auto;
  color: var(--accent);
  font-size: 12px;
}

/* List mode card layout */
#card-grid[data-view="list"] .card-item {
  display: flex;
  align-items: center;
  gap: 0;
}

#card-grid[data-view="list"] .card-thumbnail,
#card-grid[data-view="list"] .card-og-image {
  width: 80px;
  height: 56px;
  aspect-ratio: unset;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 0;
}

#card-grid[data-view="list"] .card-body {
  flex: 1;
  min-width: 0;
}

#card-grid[data-view="list"] .card-desc { display: none; }

#card-grid[data-view="list"] .card-footer {
  padding: 0 12px 0 0;
  flex-shrink: 0;
}

/* Shimmer skeleton */
.card-skeleton {
  background: linear-gradient(
    90deg,
    var(--shimmer-1) 25%,
    var(--shimmer-2) 50%,
    var(--shimmer-1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  aspect-ratio: 4/3;
}


/* ============================================================
   Buttons
   ============================================================ */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

.primary-btn {
  padding: 7px 14px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: opacity var(--transition);
}

.primary-btn:hover:not(:disabled) { opacity: 0.85; }
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.secondary-btn {
  padding: 7px 14px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  transition: border-color var(--transition), color var(--transition);
}

.secondary-btn:hover { border-color: var(--accent-dim); color: var(--text); }

.danger-btn {
  padding: 7px 14px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.danger-btn:hover { opacity: 0.85; }

/* Tag pills */
.tag-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  padding: 3px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.tag-pill:hover,
.tag-pill.active {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.meta-select {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.meta-select:hover, .meta-select:focus {
  border-color: var(--accent-dim);
  color: var(--text);
}

.meta-edit-btn {
  width: 26px;
  height: 26px;
  font-size: 14px;
  flex-shrink: 0;
}


/* ============================================================
   Card Detail Panel
   ============================================================ */

#card-panel:not([hidden]) {
  display: flex !important;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}

#card-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}

#card-panel-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(560px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: fadeIn 150ms ease both;
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: var(--surface);
}

#panel-image-wrap img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  background: var(--bg);
  display: block;
  border-radius: var(--radius) var(--radius) 0 0;
}

#panel-link-wrap {
  padding: 16px 16px 0;
}

.panel-link-site {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#panel-favicon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

#panel-domain {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

#panel-domain:hover { text-decoration: underline; }

#panel-og-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 4px;
}

#panel-og-image {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
}

#panel-meta {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.panel-title-input {
  width: 100%;
  padding: 6px 10px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
}

.panel-description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.panel-description-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
}

.panel-tag-input-row {
  display: flex;
}

.panel-tag-input-row input {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 20px;
}

.tag-remove-btn {
  font-size: 10px;
  padding: 0 0 0 4px;
  color: var(--accent-dim);
  line-height: 1;
  transition: color var(--transition);
}

.tag-remove-btn:hover { color: var(--danger); }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

#panel-delete { margin-left: auto; }


/* ============================================================
   Modals (overlays)
   ============================================================ */

#add-card-modal:not([hidden]),
#modal:not([hidden]),
#collection-modal:not([hidden]) {
  display: flex !important;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: fadeIn 150ms ease both;
}

.modal-box h2 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Add card modal */
.add-card-modal-box {
  max-width: 480px;
  padding: 0;
  overflow: hidden;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 14px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

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

.add-card-modal-box .modal-actions {
  padding: 0 20px 20px;
  margin-top: 0;
}

/* URL fetch row */
.url-fetch-row {
  display: flex;
  gap: 8px;
}

.url-fetch-row input {
  flex: 1;
  padding: 9px 12px;
  font-size: 12px;
}

/* Link preview */
#link-preview-og {
  border-radius: var(--radius);
  overflow: hidden;
}

#preview-og-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.link-preview-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fetch-error {
  font-size: 12px;
  color: var(--danger);
}

/* Image drop zone */
.drop-zone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-dim);
  color: var(--text);
  background: rgba(201,169,110,0.03);
}

.image-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.image-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
}

.image-file-item-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.image-file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-file-item-remove {
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 4px;
  transition: color var(--transition);
}

.image-file-item-remove:hover { color: var(--danger); }


/* ============================================================
   Privacy Screen
   ============================================================ */

#privacy-screen:not([hidden]) {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  gap: 8px;
}

#privacy-time {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4rem, 12vw, 8rem);
  color: var(--text);
  letter-spacing: 0.04em;
  line-height: 1;
}

#privacy-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.privacy-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-top: 24px;
  opacity: 0.5;
}

.privacy-hint {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 8px;
  opacity: 0.5;
}


/* ============================================================
   Toasts
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: fadeIn 200ms ease both;
  pointer-events: auto;
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}


/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 680px) {
  #app-view {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 250ms ease, box-shadow 250ms ease;
    width: var(--sidebar-w);
    height: 100dvh;
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  }

  #sidebar-close { display: flex; }
  #sidebar-open { display: flex; }

  #card-grid[data-view="gallery"] {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  #card-grid[data-view="masonry"] {
    columns: 2 140px;
  }

  #card-panel-inner {
    width: 100%;
    max-height: 95dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  #card-panel:not([hidden]) {
    align-items: flex-end;
  }
}
