:root {
  --ink: #1c2430;
  --navy: #1f3a5f;
  --line: #222;
  --muted: #5a6573;
  --paper: #f7f4ef;
  --font-display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #eef3f7 0%, var(--paper) 30%);
  font-family: var(--font-body);
  line-height: 1.5;
}

.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 244, 239, 0.92);
  border-bottom: 1px solid #d7d0c5;
  backdrop-filter: blur(8px);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.brand {
  font-family: var(--font-display);
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.3rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
}

.btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid #d7d0c5;
}

.hero {
  padding: 2rem 0 1rem;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--navy);
  line-height: 1.2;
}

h1 { margin: 0 0 0.6rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { margin: 0 0 0.7rem; font-size: 1.45rem; }
h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }

.lead { margin: 0; color: var(--muted); max-width: 44rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 1.2rem 0;
}

.callout {
  background: #f4f8fa;
  border-left: 4px solid #2f6f7e;
  padding: 0.9rem 1rem;
  border-radius: 0 0.6rem 0.6rem 0;
  margin: 1rem 0;
}

.warn {
  background: #fbf6ea;
  border-left-color: #b08a3c;
}

.sheet {
  background: #fff;
  border: 1px solid #d7d0c5;
  border-radius: 1rem;
  padding: 1.1rem;
  margin: 1.2rem 0;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.06);
}

.sheet-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e8eef5;
}

.sheet-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.mal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7cm;
  align-items: flex-start;
}

.mal {
  position: relative;
  border: 1.5pt solid #111;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    #fff;
  background-size: 0.5cm 0.5cm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0.2cm;
  overflow: hidden;
}

.mal-label {
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1.25;
  color: #111;
  max-width: 95%;
}

.mal-size {
  font-size: 10pt;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 0.15cm;
}

.mal-use {
  font-size: 7.5pt;
  font-weight: 600;
  color: #333;
}

.mal-code {
  position: absolute;
  top: 0.12cm;
  left: 0.15cm;
  font-size: 7pt;
  font-weight: 800;
  background: #111;
  color: #fff;
  padding: 0.05cm 0.18cm;
  border-radius: 0.12cm;
}

.mal-cutline {
  position: absolute;
  inset: 0;
  border: 1pt dashed transparent;
  pointer-events: none;
}

.strook {
  border: 1.5pt solid #111;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4cm;
  padding: 0 0.35cm;
  margin: 0.35cm 0;
  min-height: 1.2cm;
}

.strook-bar {
  border: 1.5pt solid #111;
  background: repeating-linear-gradient(
    90deg,
    #f3f3f3,
    #f3f3f3 0.45cm,
    #fff 0.45cm,
    #fff 0.9cm
  );
  flex: 0 0 auto;
}

.strook-info {
  font-size: 9pt;
  line-height: 1.3;
}

.strook-info strong {
  display: block;
  font-size: 10.5pt;
}

.scale-check {
  display: flex;
  align-items: flex-end;
  gap: 0.8cm;
  margin: 0.8cm 0;
}

.scale-box {
  width: 5cm;
  height: 5cm;
  border: 2pt solid #111;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  font-size: 11pt;
  background: #fff;
}

.scale-note {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 28rem;
}

.legend {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.6rem 0 0;
}

.legend th,
.legend td {
  border: 1px solid #d7d0c5;
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.legend th {
  background: #e8eef5;
}

.join-note {
  font-size: 8.5pt;
  font-weight: 700;
  margin: 0.3cm 0;
}

.join-mal {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.join-part {
  border: 1.5pt solid #111;
  border-bottom-style: dashed;
  position: relative;
  background: #fff;
}

.join-part:last-child {
  border-bottom-style: solid;
}

.join-mark {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7.5pt;
  font-weight: 800;
  background: #fff;
  padding: 0 0.15cm;
}

.join-mark.top { top: -0.35cm; }
.join-mark.bottom { bottom: -0.35cm; }

.footer-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1.5rem 0 2rem;
}

@media print {
  @page {
    size: A4;
    margin: 0.6cm;
  }

  body {
    background: #fff;
    color: #000;
  }

  .no-print,
  .site-header {
    display: none !important;
  }

  .wrap {
    width: 100%;
  }

  .sheet {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0 0 0.4cm;
    break-inside: avoid-page;
  }

  .sheet.force-break {
    break-before: page;
  }

  .mal,
  .strook,
  .scale-box,
  .join-part {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  a { text-decoration: none; color: inherit; }
}
