/* ═══════════════════════════════════════════════════════════ */
/* Base — Design tokens, reset, globals                        */
/* ═══════════════════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg: #0a0a0a;
  --bg-raised: #141414;
  --bg-inset: #1a1a1a;
  --bg-hover: rgba(255,255,255,.06);
  --text-primary: #f0f0f0;
  --text-secondary: #999;
  --text-tertiary: #666;
  --accent: #e8a849;
  --accent-dim: rgba(232,168,73,.12);
  --red: #ef4444;
  --green: #22c55e;
  --blue: #6366f1;
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(255,255,255,.14);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);

  /* Motion */
  --ease: cubic-bezier(.22,.68,0,1);
  --speed: .2s;

  /* Fonts */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-primary);
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .85; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img, video { max-width: 100%; display: block; }

::selection {
  background: var(--accent);
  color: #000;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* Layout */
#root {
  min-height: 100dvh;
  position: relative;
}

.page {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.page.mounted {
  opacity: 1;
  transform: translateY(0);
}

/* Spinner */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form Fields */
.form-field {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-tertiary); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: .9rem;
  border: none;
  border-radius: var(--radius-sm);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-primary:hover { background: #f0b65d; box-shadow: 0 2px 12px rgba(232,168,73,.25); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; pointer-events: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  background: var(--bg-inset);
  color: var(--text-primary);
  font-weight: 500;
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.btn-secondary:active { transform: scale(.97); }

.btn-sm { padding: 7px 14px; font-size: .8rem; }

.btn-row {
  display: flex; gap: 10px;
  margin-top: 20px;
}

/* Visibility Picker */
.vis-picker { margin-bottom: 16px; }
.vis-options {
  display: flex; flex-direction: column; gap: 6px;
}
.vis-option {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.vis-option:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.vis-option.active { border-color: var(--accent); background: var(--accent-dim); }
.vis-option-icon { flex-shrink: 0; }
.vis-option-icon svg { width: 18px; height: 18px; }
.vis-option-text { flex: 1; }
.vis-option-label { font-size: .85rem; font-weight: 600; }
.vis-option-desc { font-size: .75rem; color: var(--text-tertiary); }
.vis-option-check { width: 18px; flex-shrink: 0; }
.vis-option-check svg { width: 16px; height: 16px; color: var(--accent); }

/* Artwork Picker */
.artwork-picker {
  display: flex; gap: 14px; align-items: center;
}
.artwork-preview {
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.artwork-preview svg { width: 24px; height: 24px; color: var(--text-tertiary); }
.artwork-preview img { width: 100%; height: 100%; object-fit: cover; }
.artwork-preview input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.artwork-info {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.artwork-info strong { color: var(--text-primary); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-dialog {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  transform: scale(.96);
  transition: transform .25s var(--ease);
}
.modal-overlay.open .modal-dialog {
  transform: scale(1);
}
.modal-dialog h3 {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 18px;
}

/* Toast */
.toast-wrap {
  position: fixed;
  top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10000;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .85rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  pointer-events: auto;
}
.toast.on {
  opacity: 1;
  transform: translateX(0);
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast-icon svg { width: 16px; height: 16px; }
.toast.ok .toast-icon { color: var(--green); }
.toast.err .toast-icon { color: var(--red); }

/* Language Buttons */
.lang-options { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-btn {
  padding: 8px 18px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.lang-btn:hover { border-color: var(--border-hover); }
.lang-btn.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
