/* ==========================================================================
   賞状・表彰状作成ツール 専用CSS
   すべてのカスタムクラスは aw- プレフィックスを付け、既存Bizroute CSSと
   衝突しないようにする。
   ========================================================================== */

/* ── Webフォント ──────────────────────────────────────────────────────
   Klee One・Yuji SyukuはBizrouteサーバー(fonts/)に設置したWOFF2を
   @font-faceで読み込む。ブラウザは実際にそのfont-familyを使うテキストが
   描画されるまでファイルを取得しないため、ユーザーが選んだときだけ通信が
   発生する。いずれもOFLライセンス（Web埋め込み・商用利用可）。
   ========================================================================== */
@font-face {
  font-family: "Klee One";
  src: url("../fonts/KleeOne-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuji Syuku";
  src: url("../fonts/YujiSyuku-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

@media (max-width: 991px) {
  body { padding-bottom: 64px; }
}

/* ── パンくず ──────────────────────────────────────────────────────── */
.aw-breadcrumb {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 16px;
}

/* ── SEO Header ───────────────────────────────────────────────────── */
.aw-seo-header {
  max-width: 1180px;
  margin: 10px auto 16px;
  padding: 0 16px;
}

.aw-seo-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.aw-seo-lead {
  color: #444;
  margin-bottom: 4px;
  line-height: 1.75;
}

.aw-seo-lead-sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

/* ── Main Layout ──────────────────────────────────────────────────── */
.aw-main-container {
  max-width: 1180px;
  margin: 0 auto 48px;
  padding: 0 16px;
}

.aw-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 992px) {
  .aw-main-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
    align-items: start;
  }

  .aw-col-preview {
    align-self: start;
    min-width: 0;
  }

  .aw-col-preview .aw-section-card {
    position: sticky;
    top: 20px;
  }
}

/* ── 4ステップ案内 ───────────────────────────────────────────────── */
.aw-quick-flow {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #f6f9fd;
  color: #315d8c;
  font-size: 0.8rem;
  font-weight: 600;
}

.aw-quick-flow span:not([aria-hidden="true"]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aw-quick-flow b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.74rem;
  line-height: 1;
}

@media (max-width: 480px) {
  .aw-quick-flow { font-size: 0.74rem; }
}

/* ── Section Cards ────────────────────────────────────────────────── */
.aw-section-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e4e9f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.aw-setting-section {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  background: #fff;
}

.aw-setting-section:last-child { margin-bottom: 0; }

.aw-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f4f8a;
  margin: 0 0 10px;
}

.aw-print-section {
  border-color: #cddff1;
  background: #f7faff;
}

.aw-print-section .aw-section-title { color: #174f88; }

/* ── 賞状の種類（チップ） ─────────────────────────────────────────── */
.aw-type-help {
  margin: -2px 0 10px;
}

.aw-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aw-type-chip {
  position: relative;
}

.aw-type-chip input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.aw-type-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid #b9d3ec;
  border-radius: 999px;
  background: #fff;
  color: #1f4f8a;
  font-size: 0.86rem;
  font-weight: 600;
  min-height: 38px;
  cursor: pointer;
}

.aw-type-chip input:checked + span {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.aw-type-chip input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── フォーム部品 ─────────────────────────────────────────────────── */
.aw-form-field { margin-bottom: 14px; }

.aw-form-field:last-child { margin-bottom: 0; }

.aw-form-field label,
.aw-form-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.aw-form-field input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  min-height: 42px;
  background: #fff;
  color: #111827;
}

.aw-form-field input:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.aw-body-textarea,
.aw-issuer-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.aw-body-textarea { min-height: 110px; }
.aw-issuer-textarea { min-height: 66px; }

.aw-body-textarea:focus,
.aw-issuer-textarea:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.aw-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 12px;
  line-height: 1.6;
}

.aw-privacy-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 8px 0 12px;
  line-height: 1.6;
}

.aw-save-status {
  font-size: 0.78rem;
  color: #2f6fb0;
  min-height: 1.2em;
  margin: 10px 0 0;
}

.aw-field-subhelp {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 0.75rem;
  line-height: 1.5;
}

.aw-type-description {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f8fafc;
  color: #526274;
  font-size: 0.78rem;
  line-height: 1.55;
}

.aw-input-action-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.aw-input-action-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.aw-btn-small {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #b9d3ec;
  border-radius: 8px;
  background: #fff;
  color: #1f4f8a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.aw-btn-small:hover { background: #eaf2fb; }

.aw-overflow-warning {
  margin: -6px 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #fef6e8;
  border: 1px solid #f0e0bb;
  color: #8a6316;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* ── 文例 ─────────────────────────────────────────────────────────── */
.aw-example-trigger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.aw-example-label { margin-bottom: 0; }

.aw-btn-tiny {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #2f6fb0;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.aw-btn-tiny:hover { background: #eaf2fb; }

.aw-example-menu {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe7f3;
  border-radius: 9px;
  background: #f7faff;
}

.aw-example-menu-hint {
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: #56708c;
}

.aw-example-menu-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aw-example-chip {
  padding: 8px 14px;
  border: 1px solid #b9d3ec;
  border-radius: 999px;
  background: #fff;
  color: #1f4f8a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
}

.aw-example-chip:hover { background: #eaf2fb; }

/* ── セグメント切替 ───────────────────────────────────────────────── */
.aw-segmented {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.aw-segmented-option {
  position: relative;
  flex: 1 1 0;
}

.aw-segmented-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.aw-segmented-option > span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #475569;
  min-height: 40px;
  border-right: 1px solid #cbd5e1;
  text-align: center;
}

.aw-segmented-option:last-child > span { border-right: none; }

.aw-segmented-option input:checked + span {
  background: #2f6fb0;
  color: #fff;
}

.aw-segmented-option input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: -2px;
}

/* ── 補助表記・詳細設定 ───────────────────────────────────────────── */
.aw-option-note {
  display: block;
  margin-top: 1px;
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.82;
}

.aw-detail-settings {
  margin-top: 4px;
  border-top: 1px solid #e8edf3;
}

.aw-detail-settings summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 2px 4px;
  color: #1f4f8a;
  font-size: 0.84rem;
  font-weight: 700;
}

.aw-detail-settings summary::-webkit-details-marker { display: none; }

.aw-detail-settings summary::before {
  content: "＋";
  display: inline-block;
  width: 1.5em;
  color: #2f6fb0;
}

.aw-detail-settings[open] summary::before { content: "−"; }

.aw-detail-settings-body { padding-top: 12px; }

.aw-frame-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.aw-frame-option { position: relative; }

.aw-frame-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.aw-frame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 88px;
  padding: 9px 7px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.aw-frame-option input:checked + .aw-frame-card {
  border-color: #2f6fb0;
  box-shadow: inset 0 0 0 1px #2f6fb0;
  background: #f5f9fd;
  color: #1f4f8a;
}

.aw-frame-option input:focus-visible + .aw-frame-card {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

.aw-frame-thumb {
  display: block;
  width: 64px;
  height: 42px;
  background: #fff;
}

.aw-frame-thumb-standard {
  border: 5px double #33425c;
  box-shadow: inset 0 0 0 1px #aab4c2;
}

.aw-frame-thumb-simple { border: 2px solid #4b5563; }

.aw-frame-thumb-none { border: 1px dashed #cbd5e1; }

.aw-frame-name {
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── ボタン群 ─────────────────────────────────────────────────────── */
.aw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #333;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  min-height: 42px;
}

.aw-btn:hover { background: #eef2f7; }

.aw-btn-primary {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.aw-btn-primary:hover { background: #245a91; }

.aw-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}

.aw-btn-outline:hover { background: #eaf2fb; }

.aw-btn-create {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  box-shadow: 0 2px 5px rgba(47, 111, 176, 0.16);
  margin-bottom: 8px;
}

.aw-print-hint { margin: 0 0 4px; }

.aw-btn-text-danger {
  background: none;
  border: none;
  color: #a83232;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 40px;
}

.aw-btn-text-danger:hover { color: #7a1f1f; }

.aw-clear-row {
  display: flex;
  justify-content: flex-end;
}

/* ── プレビュー・ツールバー ───────────────────────────────────────── */
.aw-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.aw-preview-toolbar .aw-section-title { margin: 0; }

.aw-preview-guide {
  margin: 0 0 10px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #f6f9fc;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.55;
}

.aw-preview-zoom-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  flex-wrap: wrap;
}

.aw-zoom-buttons {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.aw-zoom-btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.aw-zoom-btn:last-child { border-right: 0; }

.aw-zoom-btn:hover { background: #f1f5f9; }

.aw-zoom-btn.is-active {
  background: #2f6fb0;
  color: #fff;
}

.aw-zoom-btn:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #2f6fb0;
  outline-offset: -2px;
}

.aw-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── 用紙プレビュー ───────────────────────────────────────────────── */
.aw-col-preview .aw-section-card { background: #fbfcfe; }

.aw-paper-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  border-radius: 8px;
  background: #eef2f6;
}

.aw-paper-stage {
  position: relative;
  margin: 0 auto;
}

.aw-paper {
  background: #fff;
  border: 1px solid #dbe3ec;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  transform-origin: top left;
  overflow: hidden;
}

/* ── 賞状フォント ─────────────────────────────────────────────────── */
.aw-inner[data-font="mincho"] {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
}

.aw-inner[data-font="klee"] {
  font-family: "Klee One", "Yu Mincho", serif;
}

.aw-inner[data-font="yuji"] {
  font-family: "Yuji Syuku", "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
}

/* ── 賞状本体（枠・タイトル・受賞者名・本文・日付/贈呈者） ───────────
   横書き・縦書きどちらでも同じDOM順（タイトル→受賞者名→本文→フッター）を
   使う。要素間の間隔にはmargin-blockなど論理プロパティを使い、
   writing-modeが変わっても同じCSSで自然に向きが揃うようにする。
   ------------------------------------------------------------------ */
.aw-inner {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  color: #1f2937;
  overflow: visible;
  /* 標準枠の背景画像がブラウザの印刷最適化で省略されないようにする。
     ただし各ブラウザの印刷ダイアログ側で「背景のグラフィック」設定が
     オフになっていると、このCSSだけでは印刷されない点に注意。 */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* 「標準」は日本の賞状でよく見られる、入れ子の角枠を連ねた紗綾形調の
   帯枠。ラスター画像は使わず、小さな入れ子正方形モチーフをSVG pattern
   でstrokeに敷き詰めたものをborder-imageとして四辺・四隅に流用する。
   辺の帯模様はborder-image-repeat:roundで辺の長さに合わせて自動的に
   タイル数を調整するため、四隅（伸縮しない固定パーツ）とタイルの
   継ぎ目がずれて見えることがある。そこで四隅だけは白地でいったん
   隠したうえに、伸縮しない専用の角モチーフを別途描き、帯模様と
   継ぎ目なくつながって見えるようにしている。 */
.aw-inner[data-frame="standard"] {
  border-style: solid;
  border-width: 15px;
  border-image-slice: 24;
  border-image-repeat: round;
  border-image-source: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cdefs%3E%3Cpattern id='kf' width='18' height='18' patternUnits='userSpaceOnUse'%3E%3Crect x='2' y='2' width='14' height='14' fill='none' stroke='%2333425c' stroke-width='2'/%3E%3Crect x='6.5' y='6.5' width='5' height='5' fill='none' stroke='%2333425c' stroke-width='1.6'/%3E%3C/pattern%3E%3C/defs%3E%3Crect x='12' y='12' width='216' height='216' fill='none' stroke='url(%23kf)' stroke-width='24'/%3E%3Cg%3E%3Crect x='0' y='0' width='24' height='24' fill='%23fff'/%3E%3Crect x='4' y='4' width='16' height='16' fill='none' stroke='%2333425c' stroke-width='2.4'/%3E%3Crect x='9' y='9' width='6' height='6' fill='none' stroke='%2333425c' stroke-width='1.8'/%3E%3Crect x='216' y='0' width='24' height='24' fill='%23fff'/%3E%3Crect x='220' y='4' width='16' height='16' fill='none' stroke='%2333425c' stroke-width='2.4'/%3E%3Crect x='225' y='9' width='6' height='6' fill='none' stroke='%2333425c' stroke-width='1.8'/%3E%3Crect x='0' y='216' width='24' height='24' fill='%23fff'/%3E%3Crect x='4' y='220' width='16' height='16' fill='none' stroke='%2333425c' stroke-width='2.4'/%3E%3Crect x='9' y='225' width='6' height='6' fill='none' stroke='%2333425c' stroke-width='1.8'/%3E%3Crect x='216' y='216' width='24' height='24' fill='%23fff'/%3E%3Crect x='220' y='220' width='16' height='16' fill='none' stroke='%2333425c' stroke-width='2.4'/%3E%3Crect x='225' y='225' width='6' height='6' fill='none' stroke='%2333425c' stroke-width='1.8'/%3E%3C/g%3E%3C/svg%3E");
}

/* 「標準」のときは、罫線パターンの代わりに用紙の向きごとに用意された
   装飾フレームSVGを用紙全体の背景として敷く。SVGは四辺一体の一枚絵
   （九分割不可）のため、border-imageではなくbackground-imageで全面に
   伸縮させる。横向き・縦向きでそれぞれ専用に描かれた別ファイルを使う。 */
.aw-inner[data-frame="standard"][data-orientation="landscape"] {
  border: none;
  background-image: url("../img/svg/award-frame-beside.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.aw-inner[data-frame="standard"][data-orientation="portrait"] {
  border: none;
  background-image: url("../img/svg/award-frame- vertical.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.aw-inner[data-frame="simple"] { border: 2px solid #333; }
.aw-inner[data-frame="none"] { border: none; }

.aw-title,
.aw-awardee,
.aw-body,
.aw-footer {
  text-align: center;
  margin-block: 0;
}

.aw-title {
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-block-end: 0.5em;
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-title[data-size="sm"] { font-size: 3.2rem; }
.aw-title[data-size="md"] { font-size: 3.8rem; }
.aw-title[data-size="lg"] { font-size: 4.4rem; }

.aw-awardee {
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-block-end: 0.9em;
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-awardee[data-size="sm"] { font-size: 2.2rem; }
.aw-awardee[data-size="md"] { font-size: 2.7rem; }
.aw-awardee[data-size="lg"] { font-size: 3.2rem; }

.aw-body {
  text-align: start;
  line-height: 2;
  margin-block-end: 1.2em;
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-body[data-size="sm"] { --aw-body-base-size: calc(1.4rem + 6pt); }
.aw-body[data-size="md"] { --aw-body-base-size: calc(1.6rem + 6pt); }
.aw-body[data-size="lg"] { --aw-body-base-size: calc(1.8rem + 6pt); }
.aw-body { font-size: var(--aw-body-base-size, 1.2rem); }

.aw-footer {
  margin-block-start: 8%;
  --aw-footer-base-size: 1.8rem;
  font-size: var(--aw-footer-base-size);
}

.aw-date {
  margin: 0;
  font-weight: 600;
  white-space: pre-wrap;
}

.aw-issuer {
  margin-block-start: 0.5em;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 横書き：フッターを用紙の左右中央あたりから開始する位置にし、
   日付・会社名・代表者名の行の頭（左端）を揃える */
.aw-inner[data-writing="horizontal"] .aw-footer {
  display: flex;
  align-items: flex-start;
  width: fit-content;
  margin-inline-start: calc(42% - 1em);
  margin-block-start: calc(8% + 1em);
}

.aw-inner[data-writing="horizontal"] .aw-footer-text { text-align: left; }

/* 横書きは全体（タイトル以下）を文字2つ分下げたうえで、
   タイトル・受賞者名だけ文字1つ分上へ戻す */
.aw-inner[data-writing="horizontal"] .aw-title {
  margin-block-start: 1.5em;
}

/* 横書きは本文が左右の枠に重なるため、左右それぞれ文字1つ分内側にする。
   margin-block-startは、上のタイトル位置調整による連動分を打ち消し、
   本文より下の位置が変わらないようにするための補正値。 */
.aw-inner[data-writing="horizontal"] .aw-body {
  padding-inline: 1em;
  margin-block-start: -1em;
}

/* 縦書き：writing-modeを反映し、タイトル→受賞者名→本文→(日付・贈呈者)の
   順にDOM順のまま右から左へ列として並ぶ（追加のflex制御は不要） */
.aw-inner[data-writing="vertical"] {
  writing-mode: vertical-rl;
  /* mixedだと英数字が横向きに回転してしまうため、uprightで縦向きのまま
     一字ずつ積み上げる */
  text-orientation: upright;
}

.aw-inner[data-writing="vertical"] .aw-body { line-height: 2.1; }

/* 本文の文頭が受賞者名に近すぎるため、書き出し位置を下げる。
   横書きは上端（block-start）、縦書きは各行の上端（inline-start）が
   「下」にあたるため、書字方向ごとに対応するプロパティを使い分ける。
   用紙の向きは書字方向と1対1（横＝縦書き、縦＝横書き）に固定している。 */
.aw-inner[data-writing="horizontal"] .aw-body { padding-block-start: 2em; }
.aw-inner[data-writing="vertical"] .aw-body { padding-inline-start: 3em; }

/* 縦書きはタイトルが右枠に近すぎるため文字半分ほど左へ寄せる */
.aw-inner[data-writing="vertical"] .aw-title {
  margin-block-start: 0.5em;
}

/* 縦書きのとき、受賞者名の書き出しを文字4つ分だけ下げる（横書きは対象外） */
.aw-inner[data-writing="vertical"] .aw-awardee { padding-inline-start: 4em; }

/* 縦書きのとき、日付・贈呈者名をそれぞれ文字3つ分上へ寄せる */
.aw-inner[data-writing="vertical"] .aw-date,
.aw-inner[data-writing="vertical"] .aw-issuer {
  margin-inline-start: -3em;
}

.aw-inner[data-writing="vertical"] .aw-awardee,
.aw-inner[data-writing="vertical"] .aw-date {
  white-space: nowrap;
}

/* 縦書きでは、ブロック要素のinline-size（縦書きでの高さ方向）が既定で
   用紙いっぱいに引き伸ばされ、text-alignの影響で文字列の長さごとに
   縦位置がばらばらになる。日付・贈呈者名は内容の高さぴったりに収縮させ、
   先頭が必ず揃うようにする。 */
.aw-inner[data-writing="vertical"] .aw-date,
.aw-inner[data-writing="vertical"] .aw-issuer,
.aw-inner[data-writing="vertical"] .aw-issuer-line {
  inline-size: fit-content;
}

/* 上記の収縮により日付欄が用紙の最上部まで上がってしまうため、
   これまで見えていた位置に近づくよう書き出しを7文字分下げる */
.aw-inner[data-writing="vertical"] .aw-footer {
  padding-inline-start: 7em;
}

/* ── スマートフォン固定操作バー ───────────────────────────────────── */
.aw-mobile-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e4e9f0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1);
}

.aw-mobile-action-bar .aw-btn {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

@media (min-width: 992px) {
  .aw-mobile-action-bar { display: none; }
}

/* ── 解説エリア ───────────────────────────────────────────────────── */
.aw-doc-section {
  max-width: 1180px;
  margin: 40px auto 60px;
  padding: 0 16px;
  line-height: 1.8;
  color: #374151;
}

.aw-doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 14px;
  color: #111827;
  border-left: 4px solid #2f6fb0;
  padding-left: 10px;
}

.aw-doc-section h2:first-of-type { margin-top: 0; }

.aw-doc-section h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: #1f2937;
}

.aw-doc-section p,
.aw-doc-section li {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #374151;
}

.aw-doc-section p { margin: 0 0 12px; }

.aw-faq-item {
  border-bottom: 1px solid #f3f4f6;
  padding: 12px 0;
}

.aw-faq-item:last-child { border-bottom: none; }

.aw-faq-q {
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
}

.aw-faq-a { margin: 0; }

/* 関連ページ */
.aw-related-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aw-related-link-list li {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.aw-related-link-list a {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.aw-related-link-list a:hover { text-decoration: underline; }

.aw-related-link-list .aw-note {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  margin-top: 2px;
}

/* ── レスポンシブ ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .aw-section-card { padding: 14px 14px 16px; }
  .aw-setting-section { padding: 14px 12px; }
  .aw-preview-toolbar { align-items: stretch; flex-direction: column; }
  .aw-preview-toolbar .aw-btn { width: 100%; }
  .aw-preview-zoom-row { justify-content: flex-start; }
  .aw-zoom-buttons { flex: 1 1 auto; }
  .aw-zoom-btn { flex: 1 1 0; }
  .aw-example-menu-list { flex-direction: column; align-items: stretch; }
  .aw-example-chip { text-align: center; }
  .aw-frame-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .aw-frame-thumb { width: 52px; height: 34px; }
}

@media (max-width: 380px) {
  .aw-frame-options { grid-template-columns: 1fr; }
  .aw-frame-card { flex-direction: row; justify-content: flex-start; min-height: 56px; }
}

/* ── 印刷 ─────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    padding-bottom: 0;
    margin: 0;
  }

  .aw-main-container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .aw-main-grid { display: block; }

  .aw-col-preview .aw-section-card {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    background: #fff;
  }

  .aw-paper-wrap {
    overflow: visible;
    padding: 0;
    background: transparent;
  }

  .aw-paper-stage {
    width: auto !important;
    height: auto !important;
  }

  .aw-paper {
    border: none;
    box-shadow: none;
    border-radius: 0;
    transform: none !important;
    margin: 0 !important;
  }

  @page {
    size: A4 landscape;
    margin: 0;
  }
}
