:root {
  /* 一覧の下地（#7fff00 寄り・純色より刺激は弱め） */
  --bg: #b8e868;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --border: rgba(20, 40, 20, 0.1);
  --text: #1a2e14;
  --text-muted: #5c6b55;
  /* ブランドの黄緑 */
  --accent-lime: #7fff00;
  --accent: #3d5a14;
  --accent-mid: #7fff00;
  --accent-bright: #b8ff66;
  --accent-soft: rgba(127, 255, 0, 0.22);
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --font-base: 16px;
  --font-large: 18px;
  --space: max(12px, env(safe-area-inset-left));
  --space-r: max(12px, env(safe-area-inset-right));
  --space-b: max(12px, env(safe-area-inset-bottom));
  --shadow: 0 10px 40px rgba(20, 50, 15, 0.08);
  --shadow-card: 0 1px 3px rgba(20, 40, 15, 0.06);
  color-scheme: light;
}

html.font-large {
  --font-base: 18px;
  --font-large: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-base);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  /* 少し上寄せ（下に寄りすぎない） */
  place-items: center;
  padding: 24px var(--space-r) calc(24px + var(--space-b)) var(--space);
  background: rgba(30, 50, 25, 0.22);
  backdrop-filter: blur(4px);
}

.gate[hidden] {
  display: none !important;
}

.gate__notice[hidden] {
  display: none !important;
}

.gate__panel {
  width: min(100%, 520px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}

.gate__title {
  margin: 0 0 6px;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.gate__desc {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.gate__hint {
  margin: 0 0 14px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(20, 40, 20, 0.12);
  background: rgba(255, 255, 255, 0.75);
  font-weight: 700;
  color: rgba(26, 46, 20, 0.92);
}

.gate__notice-title {
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.gate__notice-text {
  margin: 0 0 14px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.10);
  font-weight: 700;
}

.gate__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gate__actions[hidden],
.gate__intro[hidden] {
  display: none !important;
}

.gate__btn {
  flex: 1;
  min-width: 140px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.gate__btn--primary {
  border-color: rgba(127, 255, 0, 0.55);
  background: rgba(127, 255, 0, 0.18);
}

.gate__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--accent-mid);
  color: #0f1408;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  left: var(--space);
}

.sticky-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.9));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) var(--space-r) 14px var(--space);
}

.site-header__label {
  margin: 0 0 4px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-header__title {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-header__actions {
  padding-top: 4px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon__text {
  font-weight: 800;
  font-size: 1.1rem;
}

.fab {
  position: fixed;
  /* フォールバック（max()/env() 非対応でも画面内に出す） */
  right: 14px;
  bottom: 14px;
  z-index: 120;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(30, 50, 25, 0.18);
  cursor: pointer;
}

@supports (right: max(0px, 1px)) {
  .fab {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, calc(14px + env(safe-area-inset-bottom)));
  }
}

/* 明示用（HTML側でクラスを分けても破綻しない） */
.fab--warn {}

.fab:focus-visible {
  outline: 2px solid #b91c1c;
  outline-offset: 2px;
}

.fab[hidden] {
  display: none !important;
}

.main {
  padding: 8px var(--space-r) calc(24px + var(--space-b)) var(--space);
  max-width: 640px;
  margin: 0 auto;
}

.result-hint {
  margin: 8px 0 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.manual-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manual-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.manual-card:active {
  transform: scale(0.99);
}

.manual-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.manual-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.manual-card__category {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.manual-card__chev {
  color: var(--text-muted);
  flex-shrink: 0;
}

.manual-card__title {
  margin: 0 0 6px;
  font-size: var(--font-large);
  font-weight: 700;
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.manual-card__badge {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.manual-card__badge--warn {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.28);
}

.manual-card__excerpt {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  margin: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(30, 50, 25, 0.28);
  backdrop-filter: blur(3px);
}

.drawer {
  position: fixed;
  inset: 0 0 0 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 900px);
  margin-top: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  min-height: 0;
}

.drawer.is-open {
  transform: translateY(0);
}

.drawer__header {
  position: relative;
  flex-shrink: 0;
  padding: max(16px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
  touch-action: pan-y;
}

.drawer__close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drawer__category {
  margin: 0 44px 6px 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.drawer__title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.35;
  padding-right: 40px;
}

.drawer__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 16px max(16px, calc(12px + env(safe-area-inset-bottom, 0px)));
  -webkit-overflow-scrolling: touch;
}

.drawer__body:not(.drawer__body--tabs) {
  overflow-y: auto;
}

.drawer__body--tabs {
  overflow: hidden;
}

.drawer-tab-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  background: #fff;
}

.drawer-tabs--drawer {
  display: flex;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  border-radius: var(--radius);
  background: rgba(127, 255, 0, 0.12);
  border: 1px solid rgba(127, 255, 0, 0.35);
}

/* [hidden] より display:flex が勝ってタブ帯だけ残るのを防ぐ */
#drawer-tab-bar[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  border: 0;
  min-height: 0;
  overflow: hidden;
}

#drawer-tab-2[hidden] {
  display: none !important;
}

.drawer-tab {
  flex: 1;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.drawer-tab[aria-selected="true"] {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-card);
}

.drawer-tab:focus-visible {
  outline: 2px solid var(--accent-mid);
  outline-offset: 2px;
}

.drawer-tab-panels {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.drawer__body--tabs .drawer-tab-panels:not(.drawer-tab-panels--stacked) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-tab-panels--stacked {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

.drawer__body--tabs .drawer-tab-panels:not(.drawer-tab-panels--stacked) .drawer-tab-panel {
  display: none;
}

.drawer__body--tabs .drawer-tab-panels:not(.drawer-tab-panels--stacked) .drawer-tab-panel.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.drawer-tab-panels--stacked .drawer-tab-panel {
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
}

.drawer-tab-panels--stacked .drawer-tab-panel[hidden] {
  display: none !important;
}

.drawer__summary {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  touch-action: pan-y;
}

.drawer__section {
  margin-bottom: 18px;
}

.drawer__section-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.drawer__steps {
  margin: 0;
}

.step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.step__num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent);
}

.step__text {
  margin: 2px 0 0;
  flex: 1;
  font-size: 0.9375rem;
}

.drawer__detail {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
}

.drawer__detail p {
  margin: 0 0 12px;
}

.drawer__detail p:last-child {
  margin-bottom: 0;
}

.drawer__detail-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

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

.field-item {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.field-item__label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.field-item__value {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text);
}

.dialogue {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 0 6px;
}

.dialogue__preface {
  margin: 0 0 12px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.dialogue__row {
  display: flex;
  width: 100%;
}

/* LINE風：右＝スタッフ（自分側）、左＝お客様（相手） */
.dialogue__row--staff {
  justify-content: flex-end;
}

.dialogue__row--guest {
  justify-content: flex-start;
}

.dialogue__row--note {
  justify-content: center;
}

.dialogue__row--sample {
  justify-content: flex-end;
}

.dialogue__bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(92%, 22rem);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.dialogue__row--staff .dialogue__bubble {
  text-align: left;
  align-items: flex-start;
  border-radius: 16px;
  border-right: 3px solid var(--accent-mid);
  border-left: 1px solid var(--border);
  background: rgba(127, 255, 0, 0.22);
}

.dialogue__row--guest .dialogue__bubble {
  align-items: flex-start;
  text-align: left;
  border-radius: 18px 18px 18px 6px;
  border-left: 3px solid #b8c4b0;
  border-right: 1px solid var(--border);
  background: #f1f5f0;
}

.dialogue__row--note .dialogue__bubble {
  max-width: 100%;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.85);
  align-items: center;
}

.dialogue__row--sample .dialogue__bubble {
  max-width: min(92%, 22rem);
  align-items: flex-end;
  text-align: right;
  border-radius: 16px;
  border-right: 3px solid var(--accent);
  border-left: 1px solid var(--border);
  background: rgba(127, 255, 0, 0.18);
}

.dialogue__role {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dialogue__text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
}

.drawer__extras {
  display: flex;
  flex-direction: column;
  flex-shrink: 1;
  min-height: 0;
  max-height: min(48dvh, 440px);
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.drawer-tab-panel .drawer__extras {
  max-height: min(42dvh, 380px);
}

.drawer__extras--links {
  margin-top: 8px;
  margin-bottom: 14px;
  padding-top: 0;
  border-top: 0;
  max-height: none;
  overflow: visible;
}

.drawer__extras--inline {
  flex-shrink: 0;
  flex-grow: 0;
}

.drawer__extras--inline .drawer-inline-host {
  margin-bottom: 0;
}

.drawer-inline-host[hidden] {
  display: none !important;
}

.drawer-inline-host {
  flex-shrink: 0;
  margin-bottom: 14px;
}

.drawer-inline-block {
  contain: paint;
}

.drawer-inline-block + .drawer-inline-block {
  margin-top: 14px;
}

.drawer-inline-title {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text);
  line-height: 1.35;
}

.drawer-inline-frame {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(36dvh, 320px);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  position: relative;
  contain: paint;
}

.drawer-inline-block:has(.drawer-inline-pdf) .drawer-inline-frame {
  overflow: hidden;
}

.drawer-inline-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(34dvh, 300px);
  object-fit: contain;
  background: #fff;
}

.drawer-inline-pdf {
  display: block;
  width: 100%;
  height: min(34dvh, 300px);
  min-height: 220px;
  border: 0;
  border-radius: 0;
  background: #f6faf4;
}

.drawer-inline-pdf-note {
  margin: 10px 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.drawer-inline-pdf-note a {
  color: var(--accent);
  font-weight: 700;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(127, 255, 0, 0.55);
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body.drawer-open {
  overflow: hidden;
}

@media (min-width: 480px) {
  .drawer {
    left: 50%;
    right: auto;
    width: min(100% - 24px, 420px);
    margin-left: calc(min(100% - 24px, 420px) / -2);
    border-radius: var(--radius);
    margin-bottom: 16px;
    max-height: min(88dvh, 720px);
  }
}
