:root {
  --bg: #000;
  --surface: #111;
  --surface-2: #181818;
  --surface-3: #222;
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #fff;
  --muted: #8a8a8a;
  --muted-2: #6b6b6b;
  --light: #ececec;
  --radius: 12px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

[hidden] { display: none !important; }

/* Header */
.header {
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
}
.logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface);
}
.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

/* Main */
.main {
  flex: 1;
  padding-top: 48px;
  padding-bottom: 56px;
  animation: rise 0.5s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.intro { margin-bottom: 32px; }
h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.intro p {
  margin: 0;
  color: var(--muted);
}

form { display: flex; flex-direction: column; gap: 20px; }

/* Type cards */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.type-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  min-height: 44px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.type-card:hover { background: var(--surface-2); border-color: var(--border-strong); }
.type-card:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.type-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-3);
  transition: background 0.2s var(--ease);
}
.type-text { display: flex; flex-direction: column; gap: 2px; }
.type-title { font-weight: 600; font-size: 15px; }
.type-desc { font-size: 13px; color: var(--muted); transition: color 0.2s var(--ease); }

.type-card.is-selected {
  background: var(--light);
  color: #000;
  border-color: var(--light);
}
.type-card.is-selected .type-icon { background: #d4d4d4; }
.type-card.is-selected .type-desc { color: #4a4a4a; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--light);
}

input[type="text"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: #7a7a7a;
  background: var(--surface-2);
}
textarea { resize: vertical; min-height: 140px; line-height: 1.55; }

.prefixed { position: relative; }
.prefixed .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.prefixed input { padding-left: 30px; }

.select-wrap { position: relative; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
}
select option { background: #111; color: #fff; }
.chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.field-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.counter { margin-left: auto; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: #bdbdbd; }
.error { margin: 0; font-size: 12.5px; color: #d6d6d6; }

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.dropzone.is-over { background: var(--surface-3); border-color: #8a8a8a; }
.drop-text { margin: 0; color: var(--light); font-size: 14px; }
.drop-hint { margin: 0; font-size: 12px; color: var(--muted-2); }

.file-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: rise 0.25s var(--ease) both;
}
.file-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-meta { flex: 1; min-width: 0; }
.file-name {
  margin: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size { margin: 0; font-size: 12px; color: var(--muted); }
.file-remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.file-remove:hover { background: var(--surface-3); color: var(--text); }
.file-remove:focus-visible { outline: 2px solid var(--muted); }

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease), transform 0.1s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; }

.btn-primary { width: 100%; background: #fff; color: #000; }
.btn-primary:hover:not(:disabled) { background: #e6e6e6; }
.btn-primary:disabled { opacity: 0.7; }

.btn-secondary { background: var(--surface-3); color: #fff; }
.btn-secondary:hover { background: #2c2c2c; }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 13.5px; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Status */
.status {
  padding: 12px 14px;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  animation: rise 0.25s var(--ease) both;
}
.status.is-success { background: var(--light); color: #000; border-color: var(--light); }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 32px;
  font-size: 12.5px;
  color: var(--muted-2);
}
.footer p { margin: 0; }
.footer .footer-name { color: var(--muted); font-weight: 500; margin-bottom: 2px; }

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .main { padding-top: 32px; padding-bottom: 40px; }
  h1 { font-size: 24px; }
  .type-grid { grid-template-columns: 1fr; }
  .type-card { flex-direction: row; align-items: center; }
  .field-row { grid-template-columns: 1fr; gap: 20px; }
  /* 16px prevents iOS zoom on focus */
  input[type="text"], select, textarea { font-size: 16px; }
}

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