@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface2: #f0f0f0;
  --surface3: #e4e4e4;
  --border: #e2e2e2;
  --border2: #c4c4c4;
  --text: #111111;
  --text2: #555555;
  --text3: #797979;

  --blue: #222222;
  --blue-lt: #efefef;
  --blue-md: #333333;
  --blue-dim: #888888;

  --done-bg: #ebebeb;
  --done: #333333;
  --done-bd: #cccccc;

  --gift: #444444;
  --gift-bg: #f0f0f0;
  --gift-bd: #d0d0d0;
  --gift-t: #444444;
  --red: #c0392b;
  --red-bg: #fdf0ef;
  --r: 12px;
  --rsm: 8px;
}

/* ── Dark Mode ── */
html.dark {
  --bg: #111111;
  --surface: #1e1e1e;
  --surface2: #272727;
  --surface3: #333333;
  --border: #303030;
  --border2: #444444;
  --text: #f0f0f0;
  --text2: #d1d1d1;
  --text3: #898989;

  --blue: #e0e0e0;
  --blue-lt: #2a2a2a;
  --blue-md: #cccccc;
  --blue-dim: #888888;

  --done-bg: #252525;
  --done: #bbbbbb;
  --done-bd: #444444;

  --gift: #aaaaaa;
  --gift-bg: #242424;
  --gift-bd: #404040;
  --gift-t: #bbbbbb;
  --red: #e05c5c;
  --red-bg: #2a1a1a;
}
html.dark .topbar { border-bottom-color: #444; }
html.dark .bnav-add { background: #e0e0e0; color: #111 !important; }
html.dark .bnav-add:hover { background: #cccccc; }
html.dark .bottom-nav { box-shadow: 0 -2px 16px rgba(0,0,0,0.4); }
html.dark .dropdown-panel { box-shadow: 0 8px 24px rgba(0,0,0,0.5); background: #e0e0e0; color: #111; }
html.dark .btn-p { background: #e0e0e0; color: #111111; }
html.dark .btn-p:hover { background: #cccccc; color: #111111; }

/* ── Color Themes (light mode only) ── */
html.theme-yellow:not(.dark) {
  --bg: #FFF7CD;
  --surface: #FFFEF5;
  --surface2: #FFF9DC;
  --surface3: #FFF3C2;
  --border: #F0E599;
  --border2: #D9CC77;
}
html.theme-green:not(.dark) {
  --bg: #E8F8DC;
  --surface: #F4FCF0;
  --surface2: #EBF9E0;
  --surface3: #DCF2CC;
  --border: #BEE4A5;
  --border2: #9DD082;
}
html.theme-pink:not(.dark) {
  --bg: #FFDEDE;
  --surface: #FFF4F4;
  --surface2: #FFE8E8;
  --surface3: #FFD6D6;
  --border: #F5BBBB;
  --border2: #E89898;
}
html.theme-blue:not(.dark) {
  --bg: #EAF8FF;
  --surface: #F5FBFF;
  --surface2: #DCF4FF;
  --surface3: #CAEDFF;
  --border: #A8DCEE;
  --border2: #7FC4DB;
}
html.theme-purple:not(.dark) {
  --bg: #F4E6FF;
  --surface: #FAF2FF;
  --surface2: #EDD9FF;
  --surface3: #E2C4FF;
  --border: #CBA8E8;
  --border2: #B088D5;
}

body, .topbar, .sheet, .bottom-nav, .card, .dropdown-panel {
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

/* ── Drag-to-reorder ── */
.card { cursor: default; }
.card.dragging { opacity: 0.35; transform: scale(0.98); }
.card.drag-over { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-lt); }
.drag-handle {
  cursor: grab; font-size: 16px; color: var(--text3);
  padding: 0 4px; line-height: 1; user-select: none;
  display: flex; align-items: center;
}
.drag-handle:active { cursor: grabbing; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  min-height: 100vh;
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Layout ── */
#app { max-width: 560px; margin: 0 auto; padding-bottom: 80px; }

/* ── Top bar ── */
.topbar {
  border-bottom: 3px solid #333;
  padding: 12px 16px 10px;
  backdrop-filter: blur(5px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-row { cursor: pointer; flex: 1; min-width: 0; }
.event-lbl { font-size: 11px; color: var(--text3); letter-spacing: 0.5px; }
.page-title { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; color: var(--text); line-height: 1.2; }
.topbar-menu-btn {
  width: 36px; height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 18px; flex-shrink: 0;
}
.topbar-menu-btn:hover { background: var(--surface3); }

/* ── Dropdown Menu ── */
.dropdown-wrap { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  display: none;
}
.dropdown-panel.open { display: block; }
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  width: 100%;
  background: var(--surface);
  border-left: none; border-right: none; border-top: none;
  text-align: left;
}
.dd-item:last-child { border-bottom: none; }
.dd-item:hover { background: var(--surface2); color: var(--text); }
.dd-item.red { color: var(--red); }
.dd-item.red:hover { background: var(--red-bg); }

/* Theme swatches inside dropdown */
.dd-themes {
  flex-direction: column; align-items: flex-start; gap: 8px;
  cursor: default;
}
.dd-themes:hover { background: var(--surface); color: var(--text2); }
.theme-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
  outline: none;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { box-shadow: 0 0 0 2px var(--blue); border-color: var(--surface); }

/* ── Summary ── */
.summary {
  margin: 12px 16px 8px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}
.summary-lbl { font-size: 12px; color: var(--text3); font-weight: 600; }
.summary-amt { font-size: 20px; font-weight: 900; color: var(--blue); }

/* ── Gift bar ── */
.gift-bar {
  margin: 0 16px 10px;
  padding: 9px 14px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.gift-bar-lbl { font-size: 11px; color: var(--gift-t); font-weight: 700; letter-spacing: 0.5px; }
.gift-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--gift-bd); color: var(--gift-t);
  white-space: nowrap; flex-shrink: 0;
}
.gift-chip.empty { opacity: 0.4; text-decoration: line-through; }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  overflow: hidden;
  z-index: 50;
}
.bnav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 4px 12px;
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  background: none; border: none;
  gap: 3px; letter-spacing: 0.3px;
}
.bnav-btn .nav-icon { font-size: 20px; line-height: 1; }
.bnav-btn:hover, .bnav-btn.active { color: var(--blue); }
.bnav-add {
  flex: 1.5;
  background: var(--blue);
  color: #fff !important;
  border-radius: 0;
}
.bnav-add:hover { background: var(--blue-md); color: #fff; }
.bnav-add .nav-icon { font-size: 22px; }

/* ── Cards ── */
.cards { padding: 0 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
  transition: opacity 0.3s, border-color 0.2s;
}
.card.fully-done { opacity: 0.45; order: 999; }
.card-main {
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
}
.badge {
  min-width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--rsm);
  font-size: 13px; font-weight: 900;
  flex-shrink: 0;
  background: var(--blue-lt);
  color: var(--blue);
  border: 1px solid #d8d8d8;
  letter-spacing: -0.3px;
}
.badge.done-badge { background: var(--done-bg); color: var(--done); border-color: var(--done-bd); }
.card-info { flex: 1; min-width: 0; }
.card-author { font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 4px;
}
.card-amt { font-size: 12px; font-weight: 600; color: var(--text2); }
.card-items-preview { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.gtag {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  background: var(--gift-bg); color: var(--gift-t); border: 1px solid var(--gift-bd);
}
.card-side {
  display: flex; flex-direction: column; gap: 5px;
  align-items: flex-end; flex-shrink: 0;
  justify-content: space-between;
  align-self: stretch;
}
.card-side-status {
  display: flex; flex-direction: row; gap: 5px;
  align-items: flex-start; flex-wrap: wrap; justify-content: flex-end;
}
.side-btn {
  padding: 5px 10px;
  border-radius: var(--rsm);
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
}
.side-btn:hover { background: var(--surface2); }
.side-btn.edit {
  width: 32px; height: 28px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text3); border-color: var(--border2); background: var(--surface2);
  align-self: flex-end;
  margin-top: auto;
}
.side-btn.edit:hover { background: var(--surface3); color: var(--text); }
.side-btn.buy { color: var(--done); border-color: var(--done-bd); background: var(--done-bg); }
.side-btn.buy.done { background: var(--done); color: #fff; border-color: var(--done); }
.side-btn.gift-btn { color: var(--gift-t); border-color: var(--gift-bd); background: var(--gift-bg); }
.side-btn.gift-btn.done { background: var(--gift); color: #fff; border-color: var(--gift); }

.empty { text-align: center; padding: 0.1rem 1rem; color: var(--text3); font-size: 14px; font-weight: 600; }

/* ── Overlay / Modal ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(5,5,15,0.55);
  z-index: 100;
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }

.sheet {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 500px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  overflow: hidden;
}
.sheet-sm { max-width: 360px; }
.sheet-hd {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sheet-title { font-size: 16px; font-weight: 800; color: var(--text); }
.xbtn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text3); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.xbtn:hover { background: var(--surface3); color: var(--text); }
.sbody { padding: 16px 20px; overflow-y: auto; flex: 1; }
.sactions {
  display: flex; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.btn-p {
  flex: 1; background: var(--blue); color: #fff;
  border: none; border-radius: var(--rsm);
  padding: 11px; font-size: 14px; font-weight: 800;
}
.btn-p:hover { background: var(--blue-md); }
.btn-s {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--rsm); padding: 11px 16px;
  font-size: 13px; font-weight: 600; color: var(--text2);
}
.btn-d {
  background: var(--red-bg); border: 1px solid #f0aaaa;
  border-radius: var(--rsm); padding: 11px 16px;
  font-size: 13px; font-weight: 600; color: var(--red);
}

/* ── Form ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: 0.5px; margin-bottom: 6px; text-transform: uppercase; }
.finput {
  width: 100%; border: 1px solid var(--border2);
  border-radius: var(--rsm); padding: 9px 12px;
  font-size: 14px; background: var(--surface); color: var(--text);
}
.finput:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-lt); }
.dashed {
  width: 100%; border: 1.5px dashed var(--border2);
  border-radius: var(--rsm); background: none;
  padding: 9px; font-size: 13px; font-weight: 600;
  color: var(--text3); margin-bottom: 12px;
}
.dashed:hover { background: var(--surface2); color: var(--text2); }

/* Item row with qty */
.item-row {
  display: flex; gap: 6px; align-items: center; margin-bottom: 7px;
}
.item-row .finput.name { flex: 2; }
.item-row .finput.price { flex: 1; min-width: 0; }
.item-row .finput.qty { width: 60px; flex-shrink: 0; }
.delbtn {
  background: none; border: none; color: var(--text3);
  font-size: 18px; flex-shrink: 0; padding: 0 2px; line-height: 1;
}
.delbtn:hover { color: var(--red); }

/* Imgs */
.imgs-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ithumb { position: relative; width: 72px; height: 72px; }
.ithumb img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--rsm); border: 1px solid var(--border); cursor: pointer; }
.idel { position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; line-height: 1; }
.addimg { width: 72px; height: 72px; border: 1.5px dashed var(--border2); border-radius: var(--rsm); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text3); background: none; }
.addimg:hover { background: var(--surface2); }

/* Gift picker */
.gift-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.gpick {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border2);
  font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--text2); cursor: pointer;
}
.gpick.sel { background: var(--gift-bg); border-color: var(--gift); color: var(--gift-t); }
.gpick.exhausted { opacity: 0.4; cursor: not-allowed; background: var(--surface2); }

/* View sheet */
.view-lbl { font-size: 10px; color: var(--text3); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.view-val { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.view-section { margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.view-section:last-child { border-bottom: none; padding-bottom: 0; }
.view-item-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.view-item-row:last-child { border-bottom: none; }
.view-item-qty { font-size: 11px; color: var(--text3); margin-left: 4px; }
.view-total { display: flex; justify-content: space-between; padding: 10px 0 0; font-weight: 800; font-size: 15px; color: var(--blue); }
.view-url { color: var(--blue); font-size: 13px; word-break: break-all; }

/* Map */
.map-tabs {
  display: flex; gap: 0; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--rsm); overflow: hidden;
}
.map-tab {
  flex: 1; padding: 8px 4px; font-size: 12px; font-weight: 700;
  background: var(--surface2); border: none; color: var(--text3);
  border-right: 1px solid var(--border);
}
.map-tab:last-child { border-right: none; }
.map-tab.active { background: var(--surface); color: var(--blue); }
.map-tab-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.map-tab-actions button { font-size: 12px; }
.map-viewport {
  position: relative; background: var(--surface2);
  border-radius: var(--rsm); border: 1px solid var(--border);
  overflow: auto; height: 52vh; width: 100%;
}
.map-empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--text3); font-size: 14px; font-weight: 600; z-index: 2;
}
#map-inner { position: relative; transform-origin: 0 0; display: none; min-width: 100%; min-height: 100%; }
img.mapbg { display: block; width: 100%; }
#map-pins-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.map-pin {
  position: absolute; transform: translate(-50%,-100%);
  font-size: 24px; cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  z-index: 5; line-height: 1; pointer-events: auto;
  transition: transform 0.1s;
}
.map-pin:hover { transform: translate(-50%,-100%) scale(1.2); }
.map-pin-lbl {
  position: absolute; transform: translate(-50%,-100%) translateY(-28px);
  background: var(--text); color: var(--text3);
  font-size: 10px; font-weight: 800; padding: 2px 7px;
  border-radius: 4px; white-space: nowrap;
  pointer-events: none; z-index: 6;
}
.map-pin.check-pin { font-size: 20px; }
.map-zoom-bar { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.zoom-btn {
  width: 30px; height: 30px; border-radius: var(--rsm);
  border: 1px solid var(--border2); background: var(--surface);
  font-size: 16px; font-weight: 700; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
}
.zoom-btn:hover { background: var(--surface3); }
.zoom-lbl { font-size: 12px; font-weight: 700; color: var(--text); min-width: 40px; text-align: center; }
.map-hint { font-size: 12px; color: var(--text3); margin-top: 8px; }
.pin-sel-box {
  background: var(--surface2); border-radius: var(--rsm);
  padding: 12px; margin-top: 10px; border: 1px solid var(--border);
}
.pin-sel-box label { font-size: 12px; color: var(--text2); font-weight: 700; display: block; margin-bottom: 7px; }
.pin-sel {
  width: 100%; border: 1px solid var(--border2); border-radius: var(--rsm);
  padding: 9px 12px; font-size: 13px; background: var(--surface); color: var(--text);
  margin-bottom: 8px; font-weight: 600;
}
.map-pins-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.pin-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border-radius: var(--rsm);
  padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.pin-rm {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text3); font-size: 16px;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
}
.pin-rm:hover { color: var(--red); border-color: #f0aaaa; background: var(--red-bg); }

/* Pin info popup */
.pin-popup {
  position: absolute; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20; font-size: 12px;
  pointer-events: auto;
}
.pin-popup-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.pin-popup-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; color: var(--text2); }
.pin-popup-status { font-weight: 700; }
.pin-popup-status.yes { color: var(--done); }
.pin-popup-close { position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--text3); font-size: 14px; cursor: pointer; }

/* Confirm */
.confirm-box {
  background: var(--surface); border-radius: 14px;
  padding: 24px; max-width: 300px; width: 90%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.confirm-box h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.confirm-box p { font-size: 13px; color: var(--text2); margin-bottom: 18px; line-height: 1.6; }
.confirm-btns { display: flex; gap: 8px; justify-content: center; }

/* Help */
.help-section { margin-bottom: 18px; }
.help-section h3 { font-size: 12px; font-weight: 800; color: var(--blue); margin-bottom: 7px; padding-bottom: 5px; border-bottom: 1.5px solid var(--blue-lt); text-transform: uppercase; letter-spacing: 0.5px; }
.help-section p, .help-section li { font-size: 13px; color: var(--text2); line-height: 1.8; }
.help-section ul { padding-left: 18px; }
.help-note { background: #fffbee; border-radius: var(--rsm); padding: 10px 14px; font-size: 12px; font-weight: 600; color: #7a5800; margin-top: 10px; line-height: 1.6; border: 1px solid #f0e0a0; }

/* Backup */
.backup-card {
  background: var(--surface2); border-radius: var(--rsm);
  border: 1px solid var(--border); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; margin-bottom: 10px;
}
.backup-card:hover { background: var(--surface3); }
.backup-icon { font-size: 28px; width: 48px; height: 48px; background: var(--surface); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.backup-name { font-size: 14px; font-weight: 800; color: var(--text); }
.backup-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200; display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96%; max-height: 90vh; object-fit: contain; border-radius: var(--rsm); }

/* Sort wrapper */
#cards-list { display: flex; flex-direction: column; }

/* View overlay ticket style */
#ov-view .sheet {
  position: relative;
  margin-top: 18px;
  overflow: visible;
  border-radius: 0 0 0 0;
}
#ov-view .sheet::before {
  content: '';
  position: absolute;
  top: -16px; left: 0;
  width: 100%; height: 16px;
  background: radial-gradient(circle at 50% 0%, transparent 10px, var(--surface) 10px);
  background-size: 41px 16px;
  background-repeat: repeat-x;
  background-position: 0 0;
}
#ov-view .sheet::after {
  content: '';
  position: absolute;
  bottom: -16px; left: 0;
  width: 100%; height: 16px;
  background: radial-gradient(circle at 50% 100%, transparent 10px, var(--surface) 10px);
  background-size: 41px 16px;
  background-repeat: repeat-x;
  background-position: 0 0;
}
#ov-view .sactions { background: var(--surface); }
