:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #080b0f;
  --panel: rgba(16, 22, 29, 0.88);
  --panel-strong: #141b23;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f6f8fa;
  --muted: #98a5b3;
  --accent: #80e5b2;
  --accent-strong: #31bd79;
  --danger: #ff6b72;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(128, 229, 178, .45); outline-offset: 2px; }

.app { position: relative; min-height: 100vh; isolation: isolate; }
.backdrop { position: fixed; inset: 0; z-index: -2; background-position: center; background-size: cover; transition: background-image .35s ease; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,8,12,.28) 0, rgba(5,8,12,.52) 46%, rgba(8,11,15,.76) 100%), linear-gradient(90deg, rgba(5,8,12,.32), transparent 48%, rgba(5,8,12,.28)); transition: background .35s ease, backdrop-filter .35s ease; }
.theme-default .backdrop { background-image: url("default.jpg"); }
.theme-trio .backdrop { background-image: url("trio.png"); background-position: center top; }
.theme-venu .backdrop { background-image: url("venu.png"); background-position: center top; }
.theme-toise .backdrop { background-image: url("toise.png"); background-position: center top; }
.theme-zard .backdrop { background-image: url("zard.png"); background-position: center top; }
.theme-gengar .backdrop { background-image: url("gengar.png"); background-position: center top; }
.theme-scep .backdrop { background-image: url("scep.jpg"); background-position: center top; }
.theme-custom .backdrop::after { opacity: var(--custom-overlay, .7); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 12px max(24px, calc((100vw - 1180px) / 2)); background: rgba(8, 11, 15, .78); border-bottom: 1px solid var(--line); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: linear-gradient(145deg, #242d37, #0c1015); box-shadow: inset 1px 1px 0 rgba(255,255,255,.12), 0 8px 20px rgba(0,0,0,.25); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.theme-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
select, input, textarea { color: var(--text); background: rgba(7, 11, 15, .72); border: 1px solid var(--line); border-radius: 11px; transition: border-color .18s, background .18s, box-shadow .18s; }
select { padding: 9px 32px 9px 11px; }
input, textarea { width: 100%; padding: 12px 13px; }
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus { border-color: rgba(128, 229, 178, .65); background: rgba(7, 11, 15, .92); box-shadow: 0 0 0 4px rgba(128, 229, 178, .08); }

.button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; color: var(--text); background: transparent; font-weight: 720; transition: transform .16s, border-color .16s, background .16s, box-shadow .16s; }
.icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.icon-button .icon, .reveal-button .icon, .copy-button .icon, .delete-button .icon, .move-button .icon { width: 17px; height: 17px; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0) scale(.98); }
.button-primary { color: #06150e; background: linear-gradient(135deg, #a2f0c8, #4ed492); box-shadow: 0 8px 24px rgba(49, 189, 121, .2); }
.button-quiet { border-color: var(--line); background: rgba(255,255,255,.035); }
.button-quiet:hover { border-color: var(--line-strong); background: rgba(255,255,255,.07); }
.button-carbon { border-color: rgba(255,255,255,.14); background-color: #1a2027; background-image: linear-gradient(27deg, rgba(255,255,255,.045) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.045) 75%), linear-gradient(27deg, rgba(255,255,255,.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.035) 75%); background-position: 0 0, 5px 5px; background-size: 10px 10px; box-shadow: inset 1px 1px 0 rgba(255,255,255,.12), 0 8px 20px rgba(0,0,0,.22); }
.shine::after { content: ""; position: absolute; top: -85%; bottom: -85%; left: -38%; width: 24%; opacity: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); transform: translate3d(0,0,0) rotate(18deg); transform-origin: center; transition: transform .72s cubic-bezier(.22,.75,.25,1), opacity .16s ease; will-change: transform; pointer-events: none; }
.shine:hover::after { opacity: 1; transform: translate3d(650%,0,0) rotate(18deg); }
.icon-button, .reveal-button, .copy-button, .delete-button, .move-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.035); }
.icon-button:hover, .reveal-button:hover, .copy-button:hover, .move-button:hover { color: var(--text); background: rgba(255,255,255,.08); }
.move-button { cursor: grab; }
.move-button:active { cursor: grabbing; }
.move-button:disabled { cursor: not-allowed; opacity: .38; }
.copy-button.copied { color: var(--accent); border-color: rgba(128,229,178,.42); background: rgba(128,229,178,.1); }
.delete-button:hover { color: var(--danger); border-color: rgba(255,107,114,.35); background: rgba(255,107,114,.08); }

.workspace { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 40px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { position: relative; display: inline-block; max-width: 760px; margin: 0; padding: 0 4px 13px 0; font-family: Bahnschrift, "Arial Narrow", "Trebuchet MS", sans-serif; font-size: clamp(34px, 4.7vw, 58px); font-stretch: condensed; font-weight: 800; line-height: .94; letter-spacing: -.045em; text-transform: uppercase; transform: skewX(-4deg); filter: drop-shadow(0 10px 24px rgba(0,0,0,.36)); }
h1 span { color: #f7fafc; background: linear-gradient(180deg, #fff 12%, #dce5eb 58%, #aebbc5 100%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.08); }
h1 em { display: inline-block; margin-left: .08em; color: var(--accent); font-style: normal; font-weight: 900; letter-spacing: -.02em; text-shadow: 0 0 18px rgba(128,229,178,.32), 0 3px 0 rgba(5,24,16,.75); -webkit-text-stroke: 1px rgba(4,34,21,.55); }
h1::after { content: ""; position: absolute; left: 2px; bottom: 0; width: min(72%, 390px); height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-strong) 62%, transparent); box-shadow: 0 0 13px rgba(128,229,178,.45); transform: skewX(28deg); transform-origin: left; }
.hero-copy { max-width: 650px; margin-bottom: 0; color: #bdc6cf; font-size: 17px; line-height: 1.6; }
.summary { display: flex; flex: 0 0 auto; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(12,17,23,.7); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.summary div { min-width: 110px; padding: 5px 15px; }
.summary div + div { border-left: 1px solid var(--line); }
.summary strong, .summary span { display: block; }
.summary strong { font-size: 24px; }
.summary span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-field { position: relative; flex: 1; }
.search-field span { position: absolute; left: 15px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 22px; }
.search-field input { height: 46px; padding-left: 45px; background: rgba(13,18,24,.86); }

.account-form-panel { margin: 0 0 18px; padding: 22px; border: 1px solid rgba(128,229,178,.22); border-radius: var(--radius); background: rgba(14,20,26,.94); box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 22px; }
.account-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 12px; }
.account-form label > span:first-child { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 50px; }
.password-field .reveal-button { position: absolute; top: 4px; right: 4px; border: 0; }
.form-actions { display: flex; gap: 8px; }

.account-list { display: grid; gap: 12px; }
.account-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 10px 35px rgba(0,0,0,.16); backdrop-filter: blur(16px); transition: border-color .18s, transform .18s; }
.account-card:hover { border-color: var(--line-strong); }
.account-card.dragging { z-index: 2; border-color: var(--accent); opacity: .72; transform: scale(.992); box-shadow: 0 20px 55px rgba(0,0,0,.4); }
.is-reordering, .is-reordering * { cursor: grabbing !important; user-select: none !important; }
.account-card[open] { border-color: rgba(128,229,178,.27); }
.account-summary { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr) auto; align-items: center; gap: 16px; min-height: 86px; padding: 16px 18px; cursor: pointer; list-style: none; }
.account-summary::-webkit-details-marker { display: none; }
.account-summary::before { content: ""; grid-column: 1; grid-row: 1; align-self: center; width: 9px; height: 9px; margin-left: 3px; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; }
.account-card[open] .account-summary::before { transform: rotate(135deg); }
.identity { grid-column: 1; grid-row: 1; padding-left: 27px; min-width: 0; }
.identity strong, .identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity strong { font-size: 16px; }
.identity span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.credential { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.16); }
.credential-text { flex: 1; min-width: 0; overflow: hidden; color: #dce2e8; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 7px; }
.account-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.details-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; padding-top: 18px; }
.panel-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
textarea { min-height: 164px; resize: vertical; line-height: 1.5; }
.task-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.task-header .panel-label { margin: 0; }
.task-actions { display: flex; gap: 6px; }
.task-actions .button { min-height: 34px; padding: 0 11px; font-size: 12px; }
.task-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.14); }
.task-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-strong); }
.task-item input[type="text"] { padding: 7px 8px; border: 0; background: transparent; box-shadow: none; }
.task-item.done input[type="text"] { color: var(--muted); text-decoration: line-through; }
.daily-badge { display: inline-block; margin-right: 7px; padding: 2px 6px; border-radius: 99px; color: var(--accent); background: rgba(128,229,178,.1); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.task-empty { padding: 24px 10px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-state { padding: 65px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(12,17,23,.58); text-align: center; }
.empty-state.searching .button { display: none; }
.empty-icon { display: grid; place-items: center; margin-bottom: 12px; color: var(--accent); }
.empty-icon .icon { width: 38px; height: 38px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; color: var(--muted); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 11px; background: #1b242d; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { border-color: rgba(255,107,114,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.background-dialog { width: min(920px, calc(100% - 28px)); max-height: min(88vh, 900px); padding: 0; color: var(--text); border: 1px solid var(--line-strong); border-radius: 20px; background: rgba(13,18,24,.98); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
.background-dialog::backdrop { background: rgba(2,5,8,.76); backdrop-filter: blur(7px); }
.dialog-shell { padding: 24px; }
.dialog-heading, .online-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-heading { align-items: start; margin-bottom: 16px; }
.dialog-heading h2, .source-card h3, .online-heading h3 { margin: 0; }
.background-preview { position: relative; display: grid; place-items: center; min-height: 230px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background-color: #090d12; background-position: center; background-size: cover; }
.background-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,8,12,.28), rgba(8,11,15,.76)); opacity: var(--preview-overlay, .7); pointer-events: none; }
.background-preview span { position: relative; z-index: 1; }
.background-options { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-top: 12px; }
.source-card, .online-source { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.source-card p, .online-heading p { margin: 5px 0 12px; color: var(--muted); font-size: 12px; }
.file-button { width: 100%; }
.inline-form, .unsplash-controls { display: flex; gap: 8px; }
.inline-form input { min-width: 0; }
.online-source { margin-top: 12px; }
.online-heading a, .photo-credit a { color: var(--accent); font-size: 12px; }
.unsplash-controls { display: grid; grid-template-columns: 1fr 1.2fr auto; }
.image-results { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.image-result { position: relative; min-height: 105px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 10px; background: #080b0f; }
.image-result:hover, .image-result.selected { border-color: var(--accent); }
.image-result img { display: block; width: 100%; height: 105px; object-fit: cover; }
.photo-credit { position: absolute; right: 0; bottom: 0; left: 0; padding: 18px 7px 6px; color: white; background: linear-gradient(transparent, rgba(0,0,0,.82)); font-size: 10px; text-align: left; }
.visual-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.visual-controls label > span { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.visual-controls select { width: 100%; }
.visual-controls input[type="range"] { height: 39px; padding: 0; accent-color: var(--accent-strong); background: transparent; border: 0; box-shadow: none; }
.selected-attribution { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.selected-attribution a { color: var(--accent); }
.dialog-actions { margin-top: 18px; }
.dialog-actions span { flex: 1; }

@media (max-width: 900px) {
  .account-form { grid-template-columns: 1fr 1fr; }
  .form-actions { grid-column: 1 / -1; justify-content: end; }
  .account-summary { grid-template-columns: 1fr 1fr auto; }
  .identity { grid-column: 1 / -1; }
  .account-summary::before { grid-column: 1; }
  .credential { grid-row: 2; }
  .card-actions { grid-column: 3; grid-row: 2; }
  .details-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { padding: 10px 14px; }
  .brand strong { font-size: 14px; }
  .brand small, .theme-control > span, .button-label { display: none; }
  .theme-control select { width: 45px; padding-left: 8px; color: transparent; }
  .workspace { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .hero { display: block; }
  .summary { margin-top: 24px; width: 100%; }
  .summary div { flex: 1; min-width: 0; }
  .toolbar { align-items: stretch; }
  .toolbar .button { padding: 0 12px; }
  .account-form { grid-template-columns: 1fr; }
  .form-actions { grid-column: auto; }
  .account-summary { grid-template-columns: 1fr auto; gap: 10px; }
  .credential { grid-column: 1 / -1; grid-row: auto; }
  .card-actions { grid-column: 2; grid-row: 1; }
  .credential-password { display: none; }
  .account-card[open] .credential-password { display: flex; }
  .dialog-shell { padding: 16px; }
  .background-options, .visual-controls, .unsplash-controls { grid-template-columns: 1fr; }
  .image-results { grid-template-columns: repeat(2, 1fr); }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
