/* Molural — shared styles */
:root {
  --ink: #2a2426;
  --ink-soft: #6d6266;
  --paper: #ffffff;
  --line: #ece2dc;
  --line-strong: #d9cbc2;
  --accent: #1E2B6E;
  --accent-ink: #FFF3DF;
  --pop: #F2681C;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(58, 32, 20, 0.08);
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: transparent; }
body { font-family: var(--font-body); color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.4; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: 0.01em; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.app { max-width: 1180px; margin: 0 auto; padding: 8px 8px 16px; }

/* ---- top bar ---- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 4px 14px; flex-wrap: wrap; }
.brand h1 { font-size: 26px; line-height: 1.1; }
.brand p { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.bar-tools { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--paper); font-weight: 600; font-size: 14px; transition: transform .12s ease, background .15s ease, border-color .15s ease; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .4; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-size: 16px; padding: 11px 20px; }
.btn-primary:hover:not(:disabled) { background: var(--pop); border-color: var(--pop); color: #fff; }
.btn-icon { padding: 9px 11px; }
.btn-danger:hover:not(:disabled) { border-color: #E24B3B; color: #E24B3B; }
.btn-wall { text-decoration: none; background: var(--pop); border-color: var(--pop); color: #fff; }
.btn-wall:hover { background: var(--accent); border-color: var(--accent); }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wall-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
.wall-wrap svg { display: block; width: 100%; height: auto; }
.wall-wrap .shape { cursor: grab; }
.wall-wrap .shape:active { cursor: grabbing; }
.wall-wrap .handle { fill: #fff; stroke: var(--accent); stroke-width: 2; cursor: nwse-resize; }
.wall-wrap .handle.rot { cursor: grab; fill: var(--accent); }
.wall-wrap .selbox { fill: none; stroke: var(--accent); stroke-dasharray: 8 6; pointer-events: none; }
.wall-wrap .selline { stroke: var(--accent); stroke-width: 2; pointer-events: none; }
.wall-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none; color: rgba(0,0,0,.45); font-family: var(--font-display); font-size: clamp(16px, 2.6vw, 22px); padding: 20px; mix-blend-mode: multiply; }

.selbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.selbar .label { color: var(--ink-soft); font-size: 13px; margin-right: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }

/* ---- side panel ---- */
.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card h3 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.card .hint { font-size: 12px; color: var(--ink-soft); font-weight: 400; }

.swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); padding: 0; position: relative; transition: transform .12s ease; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch[data-light="1"] { border-color: rgba(0,0,0,.18); }
.swatch.custom { display: block; cursor: pointer; background: var(--picked, conic-gradient(#F2681C, #F7C74A, #7E8F2F, #82B4E4, #1E2B6E, #B9A6E0, #F4A6BD, #F2681C)); }
.swatch.custom::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.4); pointer-events: none; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }

.shape-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tile { aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--line); background: #fbf8f5; padding: 6px; display: flex; align-items: center; justify-content: center; transition: transform .12s ease, border-color .15s ease; touch-action: none; }
.tile:hover { transform: translateY(-2px); border-color: var(--line-strong); background: #fff; }
.tile svg { width: 100%; height: 100%; pointer-events: none; }
.ghost { position: fixed; width: 72px; height: 72px; pointer-events: none; z-index: 50; opacity: .9; filter: drop-shadow(0 6px 10px rgba(0,0,0,.2)); transform: translate(-50%, -50%); }

@media (max-width: 860px) {
  .swatches { grid-template-columns: repeat(7, 1fr); }
  .shape-grid { grid-template-columns: repeat(7, 1fr); }
}
@media (max-width: 520px) {
  .shape-grid { grid-template-columns: repeat(6, 1fr); }
  .brand h1 { font-size: 22px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-primary { font-size: 15px; }
}

/* ---- inline panels (submit view, featured mural) ---- */
.submit-view { max-width: 560px; margin: 0 auto; }
.submit-view .card { padding: 22px; }
.dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-size: 24px; }
.dlg p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.dlg .preview svg { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.field input { font: inherit; font-weight: 500; font-size: 15px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); }
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .fields { grid-template-columns: 1fr; } }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.note { font-size: 12px; color: var(--ink-soft); background: #fbf5ef; border-radius: 10px; padding: 8px 10px; }
.error { color: #B24338; font-size: 13px; }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: all .25s ease; pointer-events: none; z-index: 100; display: flex; gap: 12px; align-items: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast button { background: none; border: none; color: #F7C74A; font-weight: 700; padding: 0; }

/* ---- gallery ---- */
.gal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 4px 16px; }
.gal-head h1 { font-size: 28px; line-height: 1.1; }
.gal-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.mural { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); padding: 0; text-align: left; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.mural:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(58, 32, 20, 0.14); }
.mural svg { width: 100%; height: auto; display: block; }
.mural .cap { padding: 8px 10px; font-size: 12px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 8px; }
.mural .cap b { color: var(--ink); font-weight: 700; }
.mural.new { animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.gal-more { display: flex; justify-content: center; padding: 20px 0 6px; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; font-family: var(--font-display); font-size: 18px; }
.skeleton { aspect-ratio: 3/2; border-radius: 14px; background: linear-gradient(90deg, #f3ece7, #faf6f2, #f3ece7); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.featured { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 16px; max-width: 760px; margin-left: auto; margin-right: auto; animation: pop .35s ease; }
.featured .preview svg { width: 100%; height: auto; border-radius: 12px; display: block; }
.featured .meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.featured .meta h2 { font-size: 20px; }
.mural.on { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- admin ---- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eee; text-transform: uppercase; letter-spacing: .04em; }
.badge.live { background: #d8efe0; color: #1F4D2E; }
.badge.pending { background: #fde9c6; color: #7a4a00; }
.badge.hidden { background: #f5d6d6; color: #8a2a2a; }
.admin-row { display: flex; gap: 6px; padding: 8px 10px 10px; flex-wrap: wrap; align-items: center; }
.admin-row .btn { padding: 6px 10px; font-size: 12px; }

/* ---- phone layout: everything within one screen, wall stays in view ---- */
@media (max-width: 860px) {
  .layout { display: flex; flex-direction: column; gap: 10px; }
  .stage { display: contents; }
  .wall-wrap { order: 1; }
  .selbar { order: 2; flex-wrap: nowrap; overflow-x: auto; }
  .selbar .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .panel { order: 3; gap: 8px; }
  .actions { order: 4; justify-content: stretch; }
  .actions .btn { flex: 1; justify-content: center; }
  .card { padding: 10px 12px; }
  .card h3 { font-size: 14px; margin-bottom: 6px; }
  .swatches { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
  .swatches::-webkit-scrollbar { display: none; }
  .swatch { flex: none; width: 36px; height: 36px; }
  .layout > *, .panel > *, .card { min-width: 0; max-width: 100%; }
  .shape-grid { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-template-rows: repeat(2, 58px); grid-auto-columns: 58px; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
  .shape-grid::-webkit-scrollbar { display: none; }
  .tile { aspect-ratio: auto; }
  .bar { padding-bottom: 8px; }
  .brand p { display: none; }
}
