:root {
  --jp-red: #cc0000;
  --jp-red-dark: #b5000d;
  --ink: #1f2a37;
  --muted: #667085;
  --line: #d8d8d8;
  --line-soft: #ececec;
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --bg: #ffffff;
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  width: 100%;
  max-width: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: #0f4c81;
}

.site-topline,
.site-bottomline {
  height: 8px;
  background: var(--jp-red);
  width: 100%;
  flex: 0 0 auto;
}

.site-header {
  background: transparent;
  width: 100%;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  margin-top: -8px;
}

.site-header__inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.site-brand {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 0;
}

.site-brand__logo {
  width: 173px;
  max-width: min(42vw, 173px);
  height: auto;
  display: block;
  margin-top: -4px;
}

.site-brand__catchcopy {
  width: 115px;
  max-width: min(28vw, 115px);
  height: auto;
  display: block;
  margin-top: 17px;
}

.page {
  padding: 56px 20px 48px;
  width: 100%;
  flex: 1 0 auto;
}

.page__inner {
  max-width: 1024px;
  margin: 0 auto;
  width: 100%;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title__bar {
  width: 7px;
  height: 42px;
  background: var(--jp-red);
  flex: 0 0 auto;
}

.section-title h1 {
  margin: 0;
  font-size: clamp(1.65rem, 1.35rem + 0.8vw, 2.2rem);
  line-height: 1.2;
  font-weight: 700;
}

.receipt-panel {
  border: 1px solid var(--line);
  background: var(--surface);
}

.receipt-panel__row {
  display: grid;
  grid-template-columns: minmax(160px, 320px) 1fr;
  border-bottom: 1px solid var(--line);
}

.receipt-panel__label,
.receipt-panel__value {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  font-size: 0.98rem;
}

.receipt-panel__label {
  font-weight: 700;
  border-right: 1px solid var(--line);
  background: var(--surface-alt);
}

.receipt-panel__body {
  display: grid;
  grid-template-columns: minmax(180px, 320px) 1fr;
}

.receipt-panel__caption {
  padding: 36px 14px;
  font-size: 0.98rem;
  font-weight: 700;
  align-self: center;
}

.preview {
  border-left: 1px solid var(--line);
  padding: 12px;
  background: var(--surface);
}

.preview-image__viewport {
  min-height: min(72vh, 860px);
  display: block;
  overflow-x: auto;
  overflow-y: auto;
  padding: 10px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.preview-image__img {
  display: none;
  width: min(100%, 760px);
  max-width: 760px;
  height: auto;
  background: #fff;
  box-shadow: 0 0 0 1px #2f2f2f, 0 14px 28px rgba(0, 0, 0, 0.08);
  margin: 0 auto;
}

.preview-image__canvas {
  display: none;
}

.preview-image__loading {
  color: var(--muted);
  font-weight: 700;
  padding: 40px 16px;
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.actions--center {
  justify-content: center;
}

.button,
.button-secondary {
  appearance: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

.button {
  padding: 18px 28px;
  background: var(--jp-red);
  color: #fff;
  border-radius: 4px;
}

.button:hover {
  background: var(--jp-red);
}

.button--download::after {
  content: " ↓";
  font-size: 1.05em;
}

.button-secondary {
  padding: 14px 20px;
  background: #f3f4f6;
  color: var(--ink);
  border-radius: 4px;
}

.lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.8;
}

.error {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #f2c4c1;
  background: #fff1f0;
  color: #b42318;
  border-radius: 4px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 1rem;
  background: #fff;
}

.choice-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta,
.footer {
  color: var(--muted);
}

.footer {
  margin-top: 20px;
}

@media (max-width: 900px) {
  .receipt-panel__body {
    grid-template-columns: 1fr;
  }

  .receipt-panel__caption {
    padding: 18px 14px 8px;
    font-size: 0.98rem;
  }

  .preview {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .preview-image__viewport {
    min-height: 58vh;
  }
}

@media (max-width: 640px) {
  .site-header__inner {
    padding: 0;
  }

  .site-brand {
    gap: 10px;
    min-height: 0;
  }

  .site-brand__logo {
    width: 124px;
    max-width: 42vw;
    margin-top: -4px;
  }

  .site-brand__catchcopy {
    width: 84px;
    max-width: 24vw;
    margin-top: 17px;
  }

  .page {
    padding: 44px 12px 32px;
  }

  .section-title {
    gap: 10px;
    margin-bottom: 14px;
  }

  .section-title__bar {
    width: 6px;
    height: 32px;
  }

  .section-title h1 {
    font-size: 1.7rem;
  }

  .receipt-panel__row {
    grid-template-columns: 1fr;
  }

  .receipt-panel__label {
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }

  .preview-image__viewport {
    min-height: auto;
    padding: 8px;
  }

  .preview-image__img {
    width: 100%;
    max-width: 100%;
    box-shadow: 0 0 0 1px #2f2f2f;
  }

  .button {
    width: 100%;
    justify-content: center;
  }
}
