:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #111111;
  --surface-elevated: #1d1d1f;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --accent: #2997ff;
  --danger: #ff453a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000000;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(29, 29, 31, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.login-card h1 {
  font-size: 34px;
  line-height: 1.08;
}

.login-card label,
.detail-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-card input,
.login-card button {
  min-height: 44px;
  border-radius: 999px;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

.login-card input:focus {
  border-color: rgba(41, 151, 255, 0.72);
}

.login-card button,
.logout-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 0 18px;
}

.login-card button:hover,
.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
}

.login-status {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.logout-button {
  min-height: 36px;
  border-radius: 999px;
}

.app-shell {
  width: min(1400px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 28px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(42px, 6vw, 86px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.02;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.gallery-section__header input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.section-upload-button,
.add-column-button,
.detail-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 0 18px;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.section-upload-button:hover,
.add-column-button:hover,
.detail-actions button:hover,
.dialog-close:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
}

.select-field,
.detail-panel label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 13px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 151, 255, 0.2);
}

.gallery-section {
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding: 28px 0 0;
}

.gallery-section.is-dragging {
  border-color: rgba(41, 151, 255, 0.82);
}

.gallery-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.gallery-section__header h2,
.gallery-section__header p {
  margin-bottom: 0;
}

.gallery-section__header h2 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 650;
  line-height: 1.1;
}

.gallery-section__header p {
  color: var(--muted);
  font-weight: 850;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.add-column-row {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding-top: 28px;
}

.add-column-button {
  min-width: 148px;
}

.column-dialog {
  width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-elevated);
  color: var(--text);
  padding: 0;
}

.column-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(16px);
}

.column-dialog__panel {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 30px;
}

.column-dialog__panel h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.column-dialog__panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.column-dialog__actions {
  display: flex;
  justify-content: flex-end;
}

.column-dialog__actions button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 0 20px;
}

.column-dialog__actions button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.asset-card {
  display: block;
  min-width: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  text-align: left;
  cursor: grab;
  overflow: hidden;
  transition:
    filter 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.asset-card:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.asset-card:active {
  cursor: grabbing;
}

.asset-card.is-reordering {
  opacity: 0.42;
  transform: scale(0.98);
}

.asset-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(45deg, #1d1d1f 25%, transparent 25%),
    linear-gradient(-45deg, #1d1d1f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1d1d1f 75%),
    linear-gradient(-45deg, transparent 75%, #1d1d1f 75%),
    #101010;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  aspect-ratio: 4 / 3;
}

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

.detail-dialog {
  width: min(1120px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-elevated);
  color: var(--text);
  padding: 0;
  overflow: hidden;
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(16px);
}

.dialog-close {
  position: absolute;
  inset: 14px 14px auto auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  z-index: 2;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0;
}

.detail-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 580px;
  background:
    linear-gradient(45deg, #1d1d1f 25%, transparent 25%),
    linear-gradient(-45deg, #1d1d1f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1d1d1f 75%),
    linear-gradient(-45deg, transparent 75%, #1d1d1f 75%),
    #0a0a0a;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  background-size: 24px 24px;
  padding: 28px;
}

.crop-button {
  position: absolute;
  inset: 16px auto auto 16px;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  z-index: 3;
}

.crop-button:hover,
.crop-button.is-active {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.14);
}

.crop-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.detail-preview img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.crop-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, 0.18);
  cursor: crosshair;
}

.crop-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(41, 151, 255, 0.08);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(0, 0, 0, 0.42) inset;
}

.crop-actions {
  position: absolute;
  inset: auto 20px 20px auto;
  display: flex;
  gap: 10px;
}

.crop-actions button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
}

.crop-actions button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
}

.crop-actions button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.detail-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  border-left: 1px solid var(--line);
  background: var(--surface-elevated);
  padding: 28px;
}

.title-input {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 24px;
  font-weight: 650;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.danger-button {
  border-color: rgba(255, 111, 134, 0.35) !important;
  color: var(--danger) !important;
}

.status-text {
  min-height: 22px;
  margin-bottom: 0;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 40;
  min-width: 120px;
  transform: translate(-50%, 12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  padding: 14px 20px;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-preview {
    min-height: 360px;
  }

  .detail-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .toast {
    bottom: 18px;
  }
}
