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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #242424;
  --border: #333;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #4ade80;
  --accent-dim: rgba(74,222,128,0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, 'SF Pro Text', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.container {
  max-width: 480px; margin: 0 auto;
  padding: 24px 20px 100px;
}

h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }

/* ── Section Headers ── */
.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px;
}

/* ── Form Inputs ── */
.input-row {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.input-group { flex: 1; }
.input-group label {
  display: block; font-size: 12px; color: var(--text-muted);
  margin-bottom: 6px;
}
.input-group input {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  outline: none; transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { color: #555; }

/* ── Art Piece Card ── */
.art-card { position: relative; }
.art-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.art-card-title { font-size: 14px; font-weight: 600; }
.art-card-remove {
  background: none; border: none; color: #666;
  font-size: 20px; cursor: pointer; padding: 4px 8px;
  line-height: 1;
}
.art-card-remove:hover { color: #e55; }

/* ── Photo Upload ── */
.photo-upload {
  width: 100%; height: 120px;
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-bottom: 12px;
  overflow: hidden; position: relative;
  transition: border-color 0.2s;
}
.photo-upload:hover { border-color: var(--accent); }
.photo-upload img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-upload-label {
  color: var(--text-muted); font-size: 13px;
  text-align: center; pointer-events: none;
}
.photo-upload input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.photo-edit-btn {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7); color: #fff;
  border: none; padding: 5px 12px; border-radius: 14px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  pointer-events: auto; z-index: 2;
  backdrop-filter: blur(4px);
}
.photo-edit-btn:active { background: rgba(0,0,0,0.9); }

/* ── Buttons ── */
.btn {
  display: block; width: 100%; padding: 14px;
  border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 600;
  cursor: pointer; text-align: center;
  transition: transform 0.1s, opacity 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-add {
  background: var(--accent-dim); color: var(--accent);
  border: 1px dashed var(--accent);
  margin-bottom: 24px;
}

/* ── Bottom Action Bar ── */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 16px 20px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 20%);
}
.bottom-bar .btn { max-width: 480px; margin: 0 auto; }

/* ── Image Editor Modal ── */
#image-editor-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: #0a0a0a;
  display: flex; flex-direction: column;
}
.ie-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: #111;
}
.ie-title { color: #fff; font-size: 15px; font-weight: 600; }
.ie-btn {
  background: none; border: none; color: var(--accent);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 8px 12px;
}
.ie-cancel { color: #999; }
.ie-canvas-wrap {
  flex: 1; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#ie-canvas { display: block; touch-action: none; }
.ie-toolbar {
  display: flex; justify-content: center; gap: 32px;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: #111;
}
.ie-tool-btn {
  background: none; border: none; color: #ccc;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; font-size: 11px; padding: 8px;
}
.ie-tool-btn:active { color: var(--accent); }
.ie-tool-btn svg { width: 24px; height: 24px; }
