:root {
  --tent-ink: #17352d;
  --tent-green: #315f4f;
  --tent-green-dark: #21483c;
  --tent-mint: #eaf3ec;
  --tent-cream: #fbf7ea;
  --tent-gold: #efbf43;
  --tent-line: #cad9cf;
  --tent-muted: #65766f;
  --tent-danger: #b44141;
  --tent-success: #236a45;
  --tent-shadow: 0 18px 48px rgba(30, 65, 53, .12);

  --tent-red: #d64545;
  --tent-orange: #e08a2b;
  --tent-yellow: #d9b429;
  --tent-tgreen: #3f9257;
  --tent-blue: #3572b0;
  --tent-purple: #7a4fae;
}

* { box-sizing: border-box; }

body.tent-page {
  margin: 0;
  color: var(--tent-ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(239, 191, 67, .16), transparent 22rem),
    linear-gradient(180deg, #f6fbf7 0, #f8f5ea 42rem, #fff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.tent-wrap { width: min(1800px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 72px; }

.tent-hero {
  margin-bottom: 30px;
  padding: 38px clamp(28px, 5vw, 72px);
  color: #fff;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.06), transparent 42%), var(--tent-green);
  box-shadow: var(--tent-shadow);
}
.tent-hero-copy { max-width: 830px; }
.back-link { display: inline-flex; margin-bottom: 22px; color: #fff; font-weight: 750; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.eyebrow { margin: 0 0 7px; font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; color: #4f7466; }
.tent-hero .eyebrow { color: #d9eadf; }
.tent-hero h1 { margin: 0; font-size: clamp(2.1rem, 4vw, 3.6rem); line-height: 1.02; letter-spacing: -.04em; }
.tent-hero-copy > p:not(.eyebrow) { max-width: 760px; margin: 18px 0 0; color: #edf6f0; font-size: 1.06rem; line-height: 1.65; }
.hero-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.hero-points span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; color: #fff; font-size: .84rem; font-weight: 760; }

.privacy-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 1px solid #eecf8f;
  border-radius: 16px;
  background: #fff8e8;
  color: #6b4f13;
  font-size: .92rem;
  line-height: 1.6;
}
.privacy-banner strong { color: #8a5f0e; }
.privacy-icon { flex: 0 0 auto; font-size: 1.3rem; }

.tent-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 640px); gap: 28px; align-items: start; }

.panel, .preview-panel {
  border: 1px solid rgba(49, 95, 79, .15);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 12px 34px rgba(31,65,53,.08);
  padding: clamp(20px, 3vw, 30px);
  margin-bottom: 20px;
}
.builder { display: block; }

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel h2, .preview-panel h2 { margin: 0; font-size: clamp(1.2rem, 1.8vw, 1.5rem); letter-spacing: -.02em; color: var(--tent-green-dark); }
.step-number { display: grid; place-items: center; float: left; width: 30px; height: 30px; margin: 0 11px 8px 0; border-radius: 50%; color: var(--tent-green-dark); background: var(--tent-gold); font-weight: 900; font-size: .9rem; }

.ghost-button {
  flex: 0 0 auto;
  border: 1px solid #cfe0d5;
  background: var(--tent-mint);
  color: var(--tent-green-dark);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .86rem;
  font-weight: 700;
}
.ghost-button:hover { background: #dcefe1; }

label { display: block; color: #39564c; font-size: .85rem; font-weight: 750; }
input[type="text"], select, textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #b9cbc0;
  border-radius: 11px;
  background: #fff;
  color: #183b30;
  padding: 10px 12px;
  font-weight: 500;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--tent-gold);
  box-shadow: 0 0 0 3px rgba(239, 191, 67, .28);
}

.names-textarea { min-height: 190px; line-height: 1.7; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; resize: vertical; }
.field-help { margin: 8px 0 0; color: var(--tent-muted); font-size: .82rem; }
.name-count { margin: 6px 0 0; color: var(--tent-green-dark); font-size: .84rem; font-weight: 700; }

.mode-switch { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.mode-switch label { display: flex; align-items: center; gap: 7px; font-weight: 700; color: #2c463c; }
.mode-switch input { width: auto; margin: 0; }

.color-mode-switch { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-bottom: 14px; }
.color-mode-switch label { display: flex; align-items: center; gap: 7px; font-weight: 700; color: #2c463c; }
.color-mode-switch input { width: auto; margin: 0; }

.color-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.color-swatch { position: relative; }
.color-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-swatch span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #f1f4f2;
  font-weight: 750;
  font-size: .84rem;
  color: #2c463c;
}
.color-swatch input:checked + span { border-color: var(--swatch-color); background: color-mix(in srgb, var(--swatch-color) 14%, #fff); }
.color-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--swatch-color); flex: 0 0 auto; }

.form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 14px; }
.generate-button {
  border: 0;
  border-radius: 999px;
  background: var(--tent-green);
  color: #fff;
  padding: 13px 22px;
  font-weight: 800;
  box-shadow: 0 5px 0 var(--tent-green-dark);
}
.generate-button:hover { background: #3a6c5a; }
.generate-button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--tent-green-dark); }
.generation-status { margin: 0; color: var(--tent-muted); font-size: .9rem; }
.generation-status[data-state="success"] { color: var(--tent-success); }
.generation-status[data-state="error"] { color: var(--tent-danger); }

.download-row { display: flex; flex-wrap: wrap; gap: 12px; }
.download-button {
  border: 1px solid var(--tent-green);
  border-radius: 999px;
  background: #fff;
  color: var(--tent-green-dark);
  padding: 11px 18px;
  font-weight: 750;
}
.download-button:hover:not(:disabled) { background: var(--tent-mint); }

.fold-instructions {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--tent-mint);
  color: var(--tent-green-dark);
  font-size: .86rem;
  line-height: 1.6;
}
.fold-instructions strong { color: var(--tent-green-dark); }

.preview-panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; }
.preview-heading p { margin: 4px 0 0; color: var(--tent-muted); font-size: .86rem; }
.preview-empty { color: var(--tent-muted); font-size: .9rem; }

/* ---- Mini on-screen preview of each tent card ---- */
.preview-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.mini-tent {
  border: 1px solid var(--tent-line);
  border-radius: 14px;
  background: var(--tent-cream);
  padding: 10px;
}
.mini-tent-strip { display: flex; flex-direction: column; height: 220px; background: #fff; border-radius: 8px; overflow: hidden; }
.mini-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-bottom: 1px dashed #b9c7be;
  text-align: center;
}
.mini-panel:last-of-type { border-bottom: none; }
.mini-panel.is-base { background: repeating-linear-gradient(45deg, #f4f6f4, #f4f6f4 6px, #eceff0 6px, #eceff0 12px); }
.mini-panel.is-tab { flex: 0 0 16px; background: #eef2ef; }
.mini-fold-spacer { height: 0; border-top: 1px dashed #b9c7be; flex: 0 0 auto; }
.mini-name-box { border: 2px solid var(--swatch-color, var(--tent-green)); border-radius: 8px; padding: 4px 6px; width: 100%; }
.mini-line { display: block; overflow-wrap: break-word; line-height: 1.15; }
.mini-line-chinese { font-weight: 800; font-size: 1.1rem; color: var(--tent-green-dark); }
.mini-line-name { font-weight: 750; font-size: 1rem; color: var(--tent-green-dark); }
.mini-line-pinyin { font-size: .85rem; font-style: italic; color: var(--tent-muted); }

.mini-name-box[data-lines="2"] .mini-line-chinese { font-size: 1rem; }
.mini-name-box[data-lines="2"] .mini-line-name { font-size: .92rem; }
.mini-name-box[data-lines="2"] .mini-line-pinyin { font-size: .76rem; }

.mini-name-box[data-lines="3"] .mini-line-chinese { font-size: .92rem; }
.mini-name-box[data-lines="3"] .mini-line-name { font-size: .82rem; }
.mini-name-box[data-lines="3"] .mini-line-pinyin { font-size: .68rem; }
.mini-tent-label { margin: 8px 0 0; text-align: center; font-size: .78rem; font-weight: 750; color: var(--tent-green-dark); }

@media (max-width: 980px) {
  .tent-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; max-height: none; }
}

/* ---- Full-size printable tent page ---- */
.tent-print-area { display: none; }

.tent-print-area > .tent-page {
  width: 11in;
  height: 8.5in;
  padding: .35in;
  background: #fff;
}
.tent-strip {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
}
.tent-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .12in .5in;
  position: relative;
}
.tent-panel.is-tab { flex: 0 0 .7in; }
.tent-name-box {
  width: 100%;
  border: 4px solid var(--swatch-color, var(--tent-green));
  border-radius: 18px;
  padding: .18in .3in;
  text-align: center;
}
/* Name text reads normally, left-to-right—parallel to the horizontal fold lines below—
   so it stays upright and legible once the strip is folded into a flat-lying triangle. */
.tent-line { display: block; overflow-wrap: break-word; line-height: 1.2; }
.tent-line-chinese { font-size: clamp(2.2rem, 8vh, 4rem); font-weight: 800; color: var(--tent-green-dark); font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif; }
.tent-line-pinyin { font-size: clamp(1.3rem, 4vh, 2rem); color: var(--tent-muted); font-style: italic; }
.tent-line-name { font-size: clamp(1.8rem, 6vh, 3rem); font-weight: 700; color: var(--tent-green-dark); }

.tent-name-box[data-lines="2"] .tent-line-chinese { font-size: clamp(2rem, 7vh, 3.6rem); }
.tent-name-box[data-lines="2"] .tent-line-pinyin { font-size: clamp(1.1rem, 3.4vh, 1.7rem); }
.tent-name-box[data-lines="2"] .tent-line-name { font-size: clamp(1.6rem, 5vh, 2.6rem); }

.tent-name-box[data-lines="3"] .tent-line-chinese { font-size: clamp(1.8rem, 6vh, 3.2rem); }
.tent-name-box[data-lines="3"] .tent-line-pinyin { font-size: clamp(1rem, 2.8vh, 1.4rem); }
.tent-name-box[data-lines="3"] .tent-line-name { font-size: clamp(1.4rem, 4.2vh, 2.2rem); }

.tent-fold {
  height: 0;
  border-top: 2px dashed #9aa8a1;
  position: relative;
  flex: 0 0 auto;
}
.tent-fold::before {
  content: "\6298 FOLD \6298";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 8px;
  letter-spacing: .12em;
  color: #93a29b;
  background: #fff;
  padding: 1px 5px;
}

.tent-panel.is-base { color: var(--tent-muted); font-size: .72rem; text-align: center; }
.tent-base-label { max-width: 70%; }
.tent-panel.is-tab {
  background: repeating-linear-gradient(135deg, #f6f8f6, #f6f8f6 5px, #edf1ee 5px, #edf1ee 10px);
  font-size: 8px;
  color: #93a29b;
  text-align: center;
  letter-spacing: .08em;
}

@media print {
  @page { size: letter landscape; margin: 0; }
  body.tent-page * { visibility: hidden; }
  .tent-print-area, .tent-print-area * { visibility: visible; }
  .tent-print-area { display: block; position: absolute; top: 0; left: 0; width: 100%; }
  .tent-print-area > .tent-page { page-break-after: always; margin: 0; }
  .tent-print-area > .tent-page:last-child { page-break-after: auto; }
}
