/* finesse · register=product · shell=workbench-list+sheet · palette=lilac+editorial-purple · type=cinzel+manrope · engine=none · material=ink-flash-sheet · SOUL=7 SPECTACLE=2 DENSITY=4 */

:root {
  --page: #17141e;
  --page-outer: #110e18;
  --bg: #282433;
  --panel-2: #393449;
  --border: rgba(246, 245, 250, 0.08);
  --ink-1: #f6f5fa;
  --ink-2: #c8c2de;
  --ink-3: #b4accb;
  --accent: #7d4bb8;
  --accent-soft: rgba(125, 75, 184, 0.16);
  --on-accent: #f6f5fa;
  --glow: rgba(125, 75, 184, 0.34);
  --up: #63c795;
  --down: #e0705a;
  --warn: #e8a33d;
  --shadow: 0 1px 3px rgba(40, 28, 64, 0.35);
  --shadow-lg: 0 40px 90px -50px rgba(24, 14, 40, 0.7);
  --border-strong: rgba(246, 245, 250, 0.16);
  --danger-soft: rgba(224, 112, 90, 0.16);
  --danger-ring: rgba(224, 112, 90, 0.4);
  --up-ring: rgba(99, 199, 149, 0.35);
  --scrim-fill: rgba(17, 14, 24, 0.72);
  --r: 20px;
  --r-sm: 12px;
  --r-lg: 32px;
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-ui: "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dock-h: 76px;
  --header-h: 92px;
}

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

html,
body {
  overflow-x: clip;
}

html {
  height: 100%;
  background: var(--page-outer);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page-outer);
  color: var(--ink-1);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--page);
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

@media (min-width: 640px) {
  .frame {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
}

.gate,
.studio {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gate {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 48px) 28px calc(env(safe-area-inset-bottom) + 32px);
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 28px;
}

[hidden] {
  display: none !important;
}

.brand {
  width: min(236px, 72vw);
}

.brand img {
  width: 100%;
  height: auto;
  mix-blend-mode: screen;
}

.gate-copy {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  max-width: 26ch;
}

.gate-form {
  width: 100%;
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.field span,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.req {
  color: var(--accent);
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--ink-1);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input:hover,
.field textarea:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--down);
}

.field .err {
  margin: 0;
  font-size: 12px;
  color: var(--down);
  min-height: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
  background: var(--page);
  border-bottom: 1px solid var(--border);
  display: grid;
  justify-items: center;
  gap: 8px;
}

.header .brand {
  width: min(168px, 52vw);
}

.meta {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
}

.list {
  flex: 1;
  min-width: 0;
  padding: 12px 16px calc(var(--dock-h) + env(safe-area-inset-bottom) + 18px);
}

.group {
  margin: 0 0 22px;
}

.group-title {
  margin: 0 8px 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.08;
  overflow-wrap: anywhere;
  min-width: 0;
}

.card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 96px;
  color: var(--ink-1);
}

.card:active {
  transform: scale(0.985);
}

.thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--panel-2);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-time {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.empty {
  min-height: 52vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
  padding: 32px 20px;
}

.empty .brand {
  width: 140px;
  margin: 0 auto 8px;
  opacity: 0.7;
}

.empty h2,
.sheet h2 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
}

.empty h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.empty p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  max-width: 28ch;
}

.skeleton {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: var(--r);
  background: var(--bg);
}

.skel {
  background: var(--panel-2);
  border-radius: 8px;
}

.skel.sq {
  width: 76px;
  height: 76px;
}

.skel.ln {
  height: 14px;
  width: 70%;
  margin-top: 16px;
}

.skel.ln.short {
  width: 40%;
  margin-top: 10px;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  z-index: 30;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--page);
  border-top: 1px solid var(--border);
}

.btn-primary,
.btn-ghost,
.btn-danger {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.16s var(--ease), opacity 0.16s var(--ease);
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 24px var(--glow);
}

.btn-primary:active,
.btn-ghost:active,
.btn-danger:active,
.card:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-ghost {
  background: var(--panel-2);
  color: var(--ink-1);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--down);
}

.spin {
  width: 16px;
  height: 16px;
  border: 2px solid var(--on-accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.scrim {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  z-index: 50;
  width: min(430px, 100%);
  transform: translateX(-50%);
  background: var(--scrim-fill);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.scrim.on {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 55;
  width: min(430px, 100%);
  max-height: 86dvh;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 20px 0;
  transform: translateX(-50%) translateY(102%);
  transition: transform 0.44s var(--ease);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.sheet.on {
  transform: translateX(-50%) translateY(0);
}

.handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: var(--ink-1);
  opacity: 0.14;
  margin: 4px auto 14px;
  flex-shrink: 0;
}

.sheet h2 {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}

.sheet-grid {
  display: grid;
  gap: 16px;
  overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom) + 18px);
  min-height: 0;
}

.row-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.drop {
  min-height: 112px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.drop p {
  margin: 0;
  font-weight: 600;
}

.drop small {
  color: var(--ink-3);
  font-size: 12px;
}

.drop-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: calc(var(--r) - 4px);
}

.drop-preview[hidden] {
  display: none;
}

.sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(env(safe-area-inset-bottom) + 14px);
  background: var(--bg);
}

.lightbox {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  z-index: 60;
  width: min(430px, 100%);
  height: 100dvh;
  transform: translateX(-50%);
  background: var(--page);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lightbox-photo {
  flex: 1;
  min-height: 0;
  min-width: 0;
  background: var(--page-outer);
  display: grid;
  place-items: center;
}

.lightbox-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-bar {
  padding: 16px 18px calc(env(safe-area-inset-bottom) + 16px);
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.lightbox-bar h3 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
  min-width: 0;
}

.lightbox-bar p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.lightbox-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(398px, calc(100% - 32px));
  bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 70;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--ink-1);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
}

.toast.bad {
  border-color: var(--danger-ring);
  color: var(--down);
}

.toast.ok {
  border-color: var(--up-ring);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .sheet,
  .sheet.on {
    transform: translateX(-50%) translateY(0);
  }

  .scrim.on {
    opacity: 1;
  }

  .btn-primary:active,
  .btn-ghost:active,
  .btn-danger:active,
  .card:active {
    transform: none;
  }
}
