:root {
  --bg-a: #f2efe7;
  --bg-b: #d6e6f2;
  --ink: #1f2a37;
  --muted: #4f5d75;
  --accent: #c66b3d;
  --accent-dark: #8d4a2c;
  --panel: #ffffff;
  --border: #c9d7e4;
  --danger: #b42318;
  --success: #117a37;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 100%);
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

.page {
  padding: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));
  padding-bottom: calc(96px + var(--safe-bottom));
}

.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(31, 42, 55, 0.08);
}

h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  line-height: 1.2;
}

.subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

input,
textarea,
button {
  font-family: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  font-size: 16px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  min-height: 48px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(198, 107, 61, 0.18);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input[type="file"] {
  padding: 12px;
  line-height: 1.3;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  margin-right: 12px;
  font-size: 0.95rem;
}

.grid-two {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f1f1f1;
}

.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  z-index: 10;
}

button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  min-height: 52px;
  touch-action: manipulation;
}

button:active {
  background: var(--accent-dark);
  transform: scale(0.99);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.status {
  min-height: 22px;
  margin: 8px 0 0;
  font-size: 0.95rem;
  text-align: center;
}

.status.error {
  color: var(--danger);
  font-weight: 600;
}

.status.success {
  color: var(--success);
  font-weight: 600;
}

@media (min-width: 600px) {
  .page {
    max-width: 640px;
    margin: 0 auto;
  }
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }
  .preview {
    grid-template-columns: repeat(4, 1fr);
  }
}
