/* Invitation Maker: tool interface */
:root {
  --bg: #f6f2ea; --panel: #fffdf9; --ink: #2a241c; --muted: #7a6f60; --line: #e6ddcd;
  --accent: #a8823c; --accent-d: #8a6a2e; --tint: #fbf8f1; --tint-hover: #f5eedd;
  --device: #1d1a16; --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, system-ui, sans-serif; }

header { padding: 22px 28px 6px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
header h1 { font: 600 30px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0; letter-spacing: .01em; }
header p { margin: 0; color: var(--muted); }

main { display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: 24px; padding: 16px 28px 40px; align-items: start; }
main > section { min-width: 0; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 12px 16px 40px; }
  header { padding: 18px 16px 4px; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 20px; margin-bottom: 16px; }
.panel h2 { font: 600 13px/1 Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-d); margin: 0 0 14px; display: flex; gap: 8px; align-items: center; }
.panel h2 .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; letter-spacing: 0; }

label { display: block; font-weight: 500; margin: 12px 0 5px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=url], textarea, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: inherit; }
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(168, 130, 60, .4); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color { display: flex; flex-direction: column; gap: 5px; margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.color input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }

.drop { border: 1.5px dashed #cdbf9f; border-radius: 10px; padding: 22px 14px; text-align: center; cursor: pointer; background: var(--tint); transition: background .2s, border-color .2s; }
.drop:hover, .drop.over { background: var(--tint-hover); border-color: var(--accent); }
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop strong { display: block; font-size: 15px; margin-bottom: 3px; }
.drop span { color: var(--muted); font-size: 12.5px; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.thumb { position: relative; width: 86px; }
.thumb img { width: 86px; height: 86px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: #fff; }
.thumb .lbl { font-size: 11px; color: var(--muted); text-align: center; margin-top: 3px; }
.thumb .tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.thumb button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(30, 25, 18, .72); color: #fff; font-size: 12px; line-height: 22px; padding: 0; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: 600 13.5px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--accent-d); }
.btn.ghost:hover { background: var(--tint-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.danger { border-color: #c98e80; color: #a2402b; }
.btn.danger:hover { background: #fbeee9; }
.row.tight { margin-top: 10px; align-items: center; }

/* Page 1 text editor */
.ed { position: relative; margin-top: 14px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; -webkit-user-select: none; user-select: none; }
.ed img { display: block; width: 100%; height: auto; pointer-events: none; }
.ed .ov { position: absolute; inset: 0; }
.ed .tx { position: absolute; transform: translate(-50%, -50%); white-space: pre; line-height: 1.25; cursor: move; touch-action: none; outline: 1px dashed rgba(168, 130, 60, .5); outline-offset: 3px; }
.ed .tx:empty::before { content: "Empty text"; opacity: .4; }
.ed .tx.sel { outline: 2px solid var(--accent); }
.ed .tx.editing { cursor: text; outline: 2px solid var(--accent-d); -webkit-user-select: text; user-select: text; }
.ed .tx:focus-visible { outline: 2px solid var(--accent-d); }
.ed .guide { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--accent); display: none; pointer-events: none; }
.ed.snap .guide { display: block; }
.txprops textarea { min-height: 72px; }
.txprops input[type=color] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.txprops input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { display: grid; place-items: center; min-width: 36px; height: 34px; border: 0; border-right: 1px solid var(--line); background: #fff; color: var(--ink); font: 15px Georgia, serif; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed=true] { background: var(--accent); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent-d); outline-offset: -2px; }
.seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 10px 0 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.status { font-size: 12.5px; color: var(--accent-d); min-height: 18px; margin-top: 8px; }

.links { margin-top: 10px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.links div { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.links div:last-child { border-bottom: 0; }
.links b { font-weight: 500; white-space: nowrap; }
.links code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.links button { border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 12px; padding: 3px 8px; cursor: pointer; }
details summary { cursor: pointer; color: var(--accent-d); font-weight: 500; margin-top: 4px; }

.preview { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-bar { display: flex; gap: 10px; align-items: center; width: 100%; max-width: 420px; }
.preview-bar select { flex: 1; min-width: 0; }
.phone { width: min(400px, 100%); max-width: 100%; aspect-ratio: 9 / 18.5; max-height: calc(100vh - 120px); border-radius: 34px; border: 10px solid var(--device); background: #000; overflow: hidden; box-shadow: 0 30px 60px -25px rgba(40, 30, 10, .45); }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #222; }
.tip { color: var(--muted); font-size: 12.5px; text-align: center; max-width: 400px; }
