@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600.woff2") format("woff2"); }
:root {
  --navy: #0b0a33;
  --navy-2: #16154a;
  --accent: #d11188;
  --accent-2: #2cb5b8;
  --ink: #15142b;
  --muted: #6b6a85;
  --line: #e3e2ee;
  --bg: #f6f6fa;
  --radius: 14px;
  font-family: Poppins, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.roof { width: 26px; height: 12px; position: relative; display: inline-block; }
.roof::before, .roof::after { content: ""; position: absolute; top: 5px; width: 15px; height: 3px; border-radius: 2px; }
.roof::before { left: -1px; background: var(--accent); transform: rotate(-24deg); }
.roof::after { right: -1px; background: var(--accent-2); transform: rotate(24deg); }
.icon-btn { background: none; border: 0; color: inherit; font-size: 24px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }

.tabs { display: flex; background: var(--navy); padding: 0 8px; }
.tabs button { flex: 1; background: none; border: 0; color: #b9b8d6; padding: 10px 4px 12px; border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button.active { color: #fff; border-bottom-color: var(--accent); font-weight: 500; }

main { padding: 16px; max-width: 900px; margin: 0 auto; }
.seg { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 8px 10px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--navy); color: #fff; }
.seg.small button { padding: 7px 8px; font-size: 14px; }
.status-line { color: var(--muted); font-size: 13px; margin: 12px 2px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; cursor: pointer; display: flex; flex-direction: column; }
.card .ph { aspect-ratio: 4/3; background: var(--navy-2); position: relative; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .rib { position: absolute; left: 8px; top: 8px; background: rgba(11,10,51,.82); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.card .bd { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.card .pr { font-weight: 600; }
.card .q { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.card .ti { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .fx { font-size: 12px; color: var(--ink); margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.field input, .field textarea, .field select { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; color: var(--ink); width: 100%; }
.field textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 13px; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 600; cursor: pointer; }
.wide { width: 100%; }
button:disabled { opacity: .55; }

/* Editor */
.editor { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.editor-top { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 8px 8px; background: var(--navy); color: #fff; }
.editor-title { text-align: center; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-wrap { background: var(--navy); padding: 12px 16px 20px; display: flex; justify-content: center; }
#canvas { width: auto; height: auto; max-width: 100%; max-height: 62vh; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.35); background: var(--navy); }
.controls { padding: 16px; max-width: 640px; margin: 0 auto; }
.row { margin-bottom: 10px; }
.block { margin: 14px 0; }
.block-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.strip button { flex: 0 0 76px; height: 76px; border-radius: 10px; border: 3px solid transparent; background: var(--navy-2) center/cover no-repeat; cursor: pointer; scroll-snap-align: start; }
.strip button.active { border-color: var(--accent); }
.mini-btn { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--accent); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 13px; padding: 0; cursor: pointer; }
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
.actions button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 6px; font-size: 14px; cursor: pointer; }
.actions .primary { border: 0; background: var(--accent); color: #fff; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: 90vw; text-align: center; }
.update-bar { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--accent-2); color: var(--navy); padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.update-bar button { margin-left: 6px; border: 0; background: var(--navy); color: #fff; border-radius: 999px; padding: 4px 10px; }
