:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #c9d6e4;
  --text: #1f2937;
  --muted: #64748b;
  --navy: #0e3a75;
  --gold: #f4b400;
  --teal: #14b8a6;
  --orange: #ea580c;
  --danger: #dc2626;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  --sheet-primary: #0e3a75;
  --sheet-accent: #f4b400;
  --sheet-title: #0e3a75;
  --sheet-line: rgba(31, 41, 55, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #f6f9fc 0%, #e5edf5 100%);
  color: var(--text);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
}

body {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1420px;
  margin: 0 auto;
  padding: 18px 18px 32px;
}

.hero {
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(90deg, #2dbbc0 0%, #f0c62f 100%);
  margin-bottom: 18px;
}

.hero-accent {
  height: 7px;
  background: var(--gold);
}

.hero-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  align-items: center;
}

.hero-kicker {
  color: rgba(255, 255, 255, 0.94);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero h1 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 30px;
  line-height: 1.05;
}

.hero p {
  margin: 0;
  max-width: 780px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(201, 214, 228, 0.95);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  padding: 16px 18px 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-title {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.panel-subtitle,
.recipe-note,
.style-card-foot {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.recipe-card {
  border: 2px solid rgba(201, 214, 228, 0.9);
  border-radius: 18px;
  background: var(--panel-soft);
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.recipe-card.is-active {
  border-color: rgba(14, 58, 117, 0.85);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.recipe-thumb {
  width: 100%;
  aspect-ratio: 1.53 / 1;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  border: 1px solid rgba(201, 214, 228, 0.85);
  background: white;
}

.recipe-name {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
}

.recipe-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.panel-controls .control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #edf4ff;
  color: var(--navy);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.field-small {
  max-width: 150px;
}

.compact-field input[type="color"] {
  padding: 6px;
  min-height: 44px;
}

.recipe-note {
  margin-top: 14px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.style-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.style-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
}

.icon-current {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 70px;
}

.icon-current img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  padding: 6px;
}

.icon-current-copy {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.icon-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}

.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 8px 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.icon-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.52);
}

.icon-tile.is-selected {
  border-color: rgba(14, 58, 117, 0.78);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.icon-tile img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.icon-tile span {
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  color: var(--navy);
  font-weight: 700;
}

.chip-btn,
.app-btn {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(31, 41, 55, 0.16);
  background: #fff;
  color: var(--navy);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.chip-btn:hover,
.app-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.app-btn-primary {
  background: var(--teal);
  color: white;
  border-color: rgba(15, 118, 110, 0.34);
}

.chip-upload {
  position: relative;
  overflow: hidden;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sheet-stage {
  overflow-x: auto;
  padding-bottom: 6px;
}

.sheet-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-page {
  display: flex;
  justify-content: center;
}

.sheet {
  display: grid;
  grid-template-columns: repeat(2, 4.25in);
  grid-template-rows: repeat(5, 2.2in);
  gap: 0;
  width: 8.5in;
  height: 11in;
  position: relative;
  background: white;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.14);
}

.card {
  width: 4.25in;
  height: 2.2in;
  box-sizing: border-box;
  padding: 0.28in 0.3in 0.32in;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  --primary: var(--sheet-primary);
  --accent: var(--sheet-accent);
  --title: var(--sheet-title);
  --line-color: var(--sheet-line);
}

.bar-top {
  position: absolute;
  left: 0;
  top: 0;
  height: 0.3in;
  width: 100%;
  background: var(--primary);
  z-index: 0;
}

.bar-bottom {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 0.25in;
  width: 100%;
  background: var(--primary);
  z-index: 0;
}

.bar-bottom::before {
  content: "";
  position: absolute;
  left: 0;
  top: -0.08in;
  height: 0.08in;
  width: 100%;
  background: var(--accent);
}

.header {
  position: relative;
  margin-top: -0.02in;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--title);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15in;
  padding: 0 0.22in;
  width: 100%;
  z-index: 5;
}

.header .word {
  letter-spacing: 7px;
}

.pack-logo {
  position: static;
  width: 0.24in;
  height: 0.24in;
  object-fit: contain;
  z-index: 11;
  pointer-events: none;
}

.fields {
  font-size: 10px;
  line-height: 1.45;
  position: relative;
  z-index: 5;
}

.fields input {
  border: none;
  border-bottom: 1px solid var(--line-color);
  outline: none;
  background: transparent;
  color: #111827;
  font-family: Cambria, Georgia, serif;
  font-size: 11.5pt;
  text-align: center;
  padding: 0 2px 1px;
}

.text-fill {
  display: inline-block;
  min-width: 1.14in;
  min-height: 0.16in;
  border-bottom: 1px solid var(--line-color);
  padding: 0 2px 1px;
  color: #111827;
  font-family: Cambria, Georgia, serif;
  font-size: 11.5pt;
  text-align: center;
  vertical-align: baseline;
}

.fields input::placeholder {
  opacity: 0.55;
}

.row {
  white-space: nowrap;
}

.fields-adventure {
  margin-top: -0.2in;
  padding-bottom: 1.05in;
}

.fields-adventure .row {
  margin: 0.09in 0;
}

.fields-adventure .row:first-child {
  margin-top: 0.14in;
}

.label {
  margin-right: 4px;
}

.name-input {
  width: 3in;
  font-family: Cambria, Georgia, serif;
  font-size: 12pt;
  text-align: center;
}

.adventure-input {
  width: 1.4in;
}

.rank-inline {
  color: #1f2937;
}

.foot {
  position: absolute;
  left: 0.3in;
  right: 0.3in;
  bottom: 0.33in;
  font-size: 9px;
  z-index: 6;
}

.foot div {
  margin-top: 0.1in;
}

.foot input {
  width: 2.05in;
}

.seal {
  position: absolute;
  right: 0.25in;
  bottom: 0.25in;
  width: 0.7in;
  height: 0.7in;
  object-fit: contain;
  z-index: 10;
  pointer-events: none;
}

.fields-rank {
  margin-top: 0.16in;
  padding-bottom: 0.76in;
}

.fields-rank .row {
  margin: 0.11in 0;
}

.fields-rank .short-line {
  width: 0.74in;
}

.fields-rank .mid-line {
  width: 1.05in;
}

.fields-rank .date-line {
  width: 1.52in;
}

.fields-rank .wide-line {
  width: 2.76in;
}

.rank-blurb {
  margin-top: 0.18in;
  font-size: 11px;
  color: #444;
}

.rank-name-row {
  margin-top: 0.16in;
}

.rank-name-input {
  width: 3.1in;
  font-size: 15px;
  font-weight: 700;
}

.rank-footer-title {
  position: absolute;
  left: 0.38in;
  bottom: 0.2in;
  z-index: 12;
  color: white;
  font-size: 12px;
  line-height: 1;
}

.rank-footer-title strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.cut-guides {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.cut-guides .h {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(0, 0, 0, 0.45);
}

.cut-guides .v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(4.25in);
  width: 0;
  border-left: 1px dashed rgba(0, 0, 0, 0.45);
}

@media print {
  @page {
    size: letter;
    margin: 0;
  }

  html,
  body {
    background: white;
    margin: 0;
    padding: 0;
  }

  .app-shell {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .hero,
  .panel:not(.panel-preview) {
    display: none !important;
  }

  .panel-preview {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .panel-preview .panel-header {
    display: none !important;
  }

  .sheet-stage {
    overflow: visible;
    padding: 0;
  }

  .sheet-stack {
    gap: 0;
  }

  .sheet-page {
    page-break-after: always;
  }

  .sheet-page:last-child {
    page-break-after: auto;
  }

  .sheet {
    box-shadow: none;
  }

  .fields input {
    border-bottom: none !important;
  }
}

@media (max-width: 1080px) {
  .panel-controls .control-grid,
  .style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px 12px 22px;
  }

  .panel-controls .control-grid,
  .style-grid,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .recipe-grid {
    grid-template-columns: 1fr;
  }

  .icon-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero h1 {
    font-size: 25px;
  }
}
