/* ============================================================
   見積太郎 — Crystal Air Theme
   クリスタル / グラスモーフィズム / 透明感
   既存の HTML 構造・JS・クラス名は一切変更不要
   このファイルの内容で <style>...</style> を丸ごと置き換えてください
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --main: var(--estimate-main, #5b6ef5);
  --bg: var(--estimate-bg, #eef2ff);
  --panel: rgba(255, 255, 255, 0.52);
  --panel2: rgba(255, 255, 255, 0.44);
  --card: rgba(255, 255, 255, 0.72);

  --text: var(--estimate-text, #1a1348);
  --muted: var(--estimate-text, #5a4f82);

  --line: rgba(120, 100, 200, 0.12);

  --accent: var(--estimate-accent, #a89fde);
  --accentSoft: var(--estimate-accent-soft, rgba(140, 120, 220, 0.10));
  --accentLine: var(--estimate-accent-line, rgba(180, 160, 240, 0.45));

  --surface: var(--estimate-surface, #d8d0f8);
  --surfaceSoft: var(--estimate-surface-soft, #e4deff);
  --surfaceStrong: var(--estimate-surface-strong, #ede8ff);

  --warn: #b07a10;

  --danger: var(--estimate-danger, rgba(220, 60, 100, 0.08));
  --dangerBorder: var(--estimate-danger-border, rgba(220, 60, 100, 0.28));
  --dangerHover: var(--estimate-danger-hover, rgba(220, 60, 100, 0.13));
  --dangerText: var(--estimate-danger-text, #8b1a3a);

  /* Crystal専用トークン */
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-border-soft: rgba(255, 255, 255, 0.50);
  --glass-shadow: 0 8px 40px rgba(80, 60, 180, 0.12), 0 2px 8px rgba(80, 60, 180, 0.08);
  --glass-shadow-sm: 0 4px 20px rgba(80, 60, 180, 0.10);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --blur: blur(28px) saturate(180%);
  --blur-sm: blur(16px) saturate(160%);

  --radius: 18px;
  --radius2: 24px;
  --shadow: var(--glass-shadow);
  --shadow2: var(--glass-shadow-sm);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Plus Jakarta Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', 'Meiryo', system-ui, sans-serif;
  letter-spacing: 0.005em;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 70% at 15% 5%, #bfd8ff 0%, transparent 55%),
    radial-gradient(ellipse 80% 65% at 85% 12%, #e0d0ff 0%, transparent 55%),
    radial-gradient(ellipse 75% 70% at 10% 90%, #c0f0e0 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 88% 88%, #ffe0c8 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 50% 50%, #f0e8ff 0%, transparent 65%),
    linear-gradient(160deg, #eef4ff 0%, #f5f0ff 40%, #edfff8 75%, #fff8f0 100%);
  background-attachment: fixed;
}

/* 背景の光の粒エフェクト（CSS only） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle 3px at 20% 30%, rgba(255, 255, 255, 0.70) 0%, transparent 100%),
    radial-gradient(circle 2px at 75% 18%, rgba(255, 255, 255, 0.55) 0%, transparent 100%),
    radial-gradient(circle 4px at 55% 72%, rgba(255, 255, 255, 0.45) 0%, transparent 100%),
    radial-gradient(circle 2px at 88% 60%, rgba(255, 255, 255, 0.60) 0%, transparent 100%),
    radial-gradient(circle 3px at 35% 85%, rgba(255, 255, 255, 0.50) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: inherit;
}

/* ============================================================
   レイアウト
   ============================================================ */

.wrap {
  flex: 1 0 auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 26px 35px 70px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   トップバー（ブランド）
   ============================================================ */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius2);
  padding: 14px 18px;
  box-shadow: var(--glass-shadow), var(--glass-inset);
}

.topbar-sub {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
}

.brand-company {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.logo.has-image {
  background: rgba(255, 255, 255, 0.90);
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

/* バッジ列 */
.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: 14px;
  font-weight: 500;
  color: rgba(26, 19, 72, 0.85);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
}

.badge strong {
  color: var(--main);
  font-weight: 700;
}

/* ============================================================
   グリッド
   ============================================================ */

.grid {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .sticky {
    position: relative;
    top: auto;
  }
}

/* ============================================================
   パネル（すりガラスカード）
   ============================================================ */

.panel {
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius2);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  overflow: hidden;
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.28);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.panel-head .sub {
  color: var(--muted);
  font-size: 14px;
}

.menu-panel-head {
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.menu-panel-title {
  flex: 0 0 auto;
  min-width: 0;
}

.menu-select-row {
  flex: 0 0 auto;
  justify-content: flex-start;
  margin-left: 0;
  min-width: 0;
}

.menu-select {
  width: 360px;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 520px) {
  .menu-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-select-row {
    width: 100%;
  }

  .menu-select {
    width: 100%;
    max-width: 520px;
  }
}

.panel-body {
  padding: 18px;
}

/* ============================================================
   汎用UI
   ============================================================ */

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.select {
  appearance: none;
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 14px;
  min-width: 300px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.select:focus {
  border-color: rgba(100, 80, 220, 0.50);
  box-shadow: 0 0 0 3px rgba(100, 80, 220, 0.12), var(--glass-shadow-sm), var(--glass-inset);
}

.select {
  min-width: 0;
  width: 100%;
  max-width: 520px;
}

.hint {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.65;
  font-weight: 400;
}

/* ============================================================
   ステップ
   ============================================================ */

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius2);
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  box-shadow: 0 4px 20px rgba(80, 60, 180, 0.08), var(--glass-inset);
  overflow: hidden;
  transition: box-shadow 0.20s ease;
}

.step:hover {
  box-shadow: 0 6px 28px rgba(80, 60, 180, 0.13), var(--glass-inset);
}

.step[aria-hidden="true"] {
  display: none;
}

.step-btn {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.step-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-title strong {
  font-size: 15px;
  font-weight: 700;
}

.step-title span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.chev {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  box-shadow: var(--glass-inset);
  transition: background 0.16s ease;
}

.step.open .chev {
  background: rgba(255, 255, 255, 0.80);
  color: var(--main);
}

.step-content {
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  padding: 16px 16px 18px;
  display: none;
  background: rgba(255, 255, 255, 0.22);
}

.step.open .step-content {
  display: block;
}

/* ============================================================
   オプション
   ============================================================ */

.opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 680px) {
  .opt-grid {
    grid-template-columns: 1fr;
  }
}

.opt {
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 14px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  position: relative;
  box-shadow: 0 2px 12px rgba(80, 60, 180, 0.07), var(--glass-inset);
  transition: box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.opt:hover {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.90);
  box-shadow: 0 4px 20px rgba(80, 60, 180, 0.12), var(--glass-inset);
}

.opt.opt-qopt {
  flex-wrap: wrap;
  align-items: center;
}

.opt.opt-qopt .meta {
  flex: 1 1 240px;
  min-width: 200px;
}

.opt.opt-qopt .controls {
  margin-left: auto;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.opt.opt-qopt .qty {
  max-width: 100%;
}

@media (max-width: 420px) {
  .opt.opt-qopt .meta {
    flex: 1 1 100%;
    min-width: 0;
  }

  .opt.opt-qopt .controls {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .opt.opt-qopt .qty input {
    width: 54px;
  }

  .opt.opt-qopt .qty button {
    width: 28px;
    height: 28px;
    font-size: 17px;
  }
}

.opt.opt-qty {
  flex-wrap: wrap;
  align-items: center;
}

.opt.opt-qty .meta {
  flex: 1 1 240px;
  min-width: 200px;
}

.opt.opt-qty .controls {
  margin-left: auto;
  flex: 0 0 auto;
}

@media (max-width: 420px) {
  .opt.opt-qty .controls {
    width: 100%;
    justify-content: flex-start;
  }
}

.opt .meta {
  flex: 1 1 auto;
  min-width: 0;
}

.opt .name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.opt .desc {
  font-size: 13px;
  color: var(--muted);
  margin: 5px 0 0;
  line-height: 1.6;
  font-weight: 400;
}

.price {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.80);
  color: rgba(26, 19, 72, 0.88);
  white-space: nowrap;
  margin-top: 7px;
  box-shadow: var(--glass-inset);
}

.price.zero {
  background: rgba(255, 255, 255, 0.40);
  border-color: rgba(255, 255, 255, 0.55);
  color: rgba(26, 19, 72, 0.50);
}

/* ============================================================
   コントロール / 数量入力
   ============================================================ */

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

.qty {
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: inset 0 2px 6px rgba(80, 60, 180, 0.07);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

.qty button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: var(--glass-inset);
  transition: background 0.14s ease, transform 0.08s ease;
}

.qty button:hover {
  background: rgba(255, 255, 255, 0.95);
}

.qty button:active {
  transform: translateY(1px);
}

.qty input {
  width: 25px;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: center;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  padding: 0;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty input[type="number"] {
  -moz-appearance: textfield;
}

.inputline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.field {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field:focus {
  border-color: rgba(100, 80, 220, 0.45);
  box-shadow: 0 0 0 3px rgba(100, 80, 220, 0.10), var(--glass-shadow-sm), var(--glass-inset);
}

.radio,
.check {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--main);
}

.note {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  box-shadow: var(--glass-inset);
}

/* ============================================================
   サマリー（右カラム）
   ============================================================ */

.sticky {
  position: sticky;
  top: 14px;
}

.total {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.total .big {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.total .small {
  font-size: 13px;
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.65;
  font-weight: 400;
}

.pillrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.pill {
  font-size: 13px;
  font-weight: 500;
  color: rgba(26, 19, 72, 0.84);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.58);
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: var(--glass-inset);
}

.pill strong {
  color: var(--main);
  font-weight: 700;
}

.summary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

a.btn {
  text-decoration: none;
}

/* ============================================================
   ボタン
   ============================================================ */

.btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    transform 0.10s ease;
}

.btn.primary,
.fbtn.primary {
  background: var(--main);
  border-color: var(--main);
  color: #fff;
  box-shadow: 0 4px 20px rgba(80, 60, 200, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* 変更後 */
.btn.danger {
  background: rgba(255, 245, 248, 0.65);
  border-color: rgba(200, 50, 80, 0.32);
  color: #7a1020;
  /* 固定の濃い赤に変更 */
}

.btn.danger:hover {
  background: rgba(255, 228, 235, 0.88);
  border-color: rgba(200, 50, 80, 0.40);
  color: #7a1020;
  /* 固定の濃い赤に変更 */
}

.btn.danger:focus-visible {
  outline: 3px solid rgba(220, 60, 100, 0.18);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

.btn,
.fbtn,
.preview-clear-btn {
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    opacity 0.18s ease,
    transform 0.10s ease;
}

@media (hover: hover) and (pointer: fine) {

  .btn:not(.primary):not(.danger):hover,
  .fbtn:not(.primary):hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 28px rgba(80, 60, 180, 0.14), var(--glass-inset);
  }

  .btn.primary:hover,
  .fbtn.primary:hover {
    filter: brightness(1.10);
    box-shadow: 0 6px 28px rgba(80, 60, 200, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }

  .btn.danger:hover {
    background: rgba(255, 235, 242, 0.85);
    box-shadow: 0 4px 16px rgba(220, 60, 100, 0.14);
  }

  .preview-clear-btn:hover {
    background: rgba(255, 248, 210, 0.90);
  }
}

/* ============================================================
   内訳テーブル
   ============================================================ */

.breakdown {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  padding-top: 14px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 14px;
}

.table td {
  padding: 11px 12px;
  vertical-align: top;
}

.tr {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(80, 60, 180, 0.06), var(--glass-inset);
}

.tr td:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.tr td:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.footer-note {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(26, 19, 72, 0.55);
  line-height: 1.75;
  font-weight: 400;
}

/* ============================================================
   トースト通知
   ============================================================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(26, 19, 72, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(20, 10, 60, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  max-width: min(560px, calc(100% - 20px));
  z-index: 9999;
}

.toast.show {
  opacity: 1;
}

/* ============================================================
   モーダル
   ============================================================ */

#textModal .modal-card {
  max-width: 820px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius2);
  box-shadow: 0 16px 60px rgba(60, 40, 160, 0.18);
  overflow: hidden;
}

#textModal .modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.50);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.40);
}

#textModal textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.65;
  box-shadow: inset 0 2px 8px rgba(60, 40, 160, 0.05);
}

/* ============================================================
   SAMPLEモード用：画面上の透かし
   このフロントでは JS が #sampleWatermarkLayer 内に
   .sample-watermark-wrap / track / row / word を生成する
   ============================================================ */

.sample-watermark-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  display: none;
  overflow: hidden;
}

body.sample-mode .sample-watermark-layer {
  display: block;
}

.sample-watermark-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sample-watermark-track {
  position: absolute;
  top: 4vh;
  left: -14vw;
  width: 145vw;
  display: flex;
  flex-direction: column;
  gap: 72px;
  transform: rotate(-28deg);
  transform-origin: center center;
}

.sample-watermark-row {
  display: flex;
  gap: 72px;
  white-space: nowrap;
}

.sample-watermark-word {
  display: inline-block;
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 900;
  letter-spacing: 0.22em;
  color: rgba(26, 19, 72, 0.085);
  user-select: none;
}

/* 背景の光エフェクトより透かしを前、UI本体より後ろに置く */
body::before {
  z-index: 0;
}

.wrap,
.fixedbar,
.site-footer,
.toast,
#textModal {
  position: relative;
  z-index: 2;
}

/* 印刷用透かしは通常表示では隠す */
.print-sample-watermark {
  display: none;
}

/* ============================================================
   印刷
   ============================================================ */

@media print {
  @page {
    size: A4;
    margin: 18mm 20mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    overflow: auto !important;
  }

  body::before {
    display: none !important;
  }

  /* 画面側の透かしは印刷では消す */
  .sample-watermark-layer {
    display: none !important;
  }

  /*
    印刷時は core.js が作る #printArea のみを表示。
    ここを入れないと、通常画面側の .wrap / .fixedbar と
    印刷用の透かし制御が混ざりやすい。
  */
  body>*:not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
    background: #fff !important;
    color: #000 !important;
  }

  * {
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.sample-mode #printArea .print-sample-watermark {
    display: block !important;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
  }

  body.sample-mode #printArea .print-sample-watermark-track {
    position: absolute;
    top: 6%;
    left: -12%;
    width: 132%;
    display: flex;
    flex-direction: column;
    gap: 82px;
    transform: rotate(-28deg);
    transform-origin: center center;
  }

  body.sample-mode #printArea .print-sample-watermark-row {
    display: flex;
    gap: 72px;
    white-space: nowrap;
  }

  body.sample-mode #printArea .print-sample-watermark-word {
    display: inline-block;
    font-size: 58px;
    font-weight: 900;
    letter-spacing: 0.24em;
    color: rgba(20, 30, 60, 0.08);
    user-select: none;
  }

  body.sample-mode #printArea>*:not(.print-sample-watermark) {
    position: relative;
    z-index: 1;
  }

  .wrap {
    max-width: 900px;
    margin: 0 auto;
  }

  .panel {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
  }

  .panel-head {
    background: #f5f5f5 !important;
  }

  .badge-row,
  .summary-actions,
  .hint,
  .note,
  .toast,
  .fixedbar,
  #fixedBarSpacer {
    display: none !important;
  }

  .grid {
    grid-template-columns: 1fr !important;
  }

  .sticky {
    position: relative !important;
  }

  .step {
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
  }

  .opt,
  .step {
    background: #fff !important;
    box-shadow: none !important;
  }

  .table {
    font-size: 13px;
  }

  .tr {
    border: 1px solid #ddd;
    box-shadow: none !important;
    background: #fff !important;
  }

  .muted {
    color: #555 !important;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }
}

/* ============================================================
   固定バー（上部）— 白いすりガラス
   ============================================================ */

.fixedbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9000;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 24px rgba(80, 60, 180, 0.10);
}

.fixedbar-inner {
  max-width: 100%;
  margin: 0;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.fixedbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.fixedbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.fixedbar-amountwrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.fixedbar-amount {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.taxpill {
  border: 1px solid rgba(100, 80, 200, 0.22);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: var(--glass-inset);
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.taxpill:hover {
  background: rgba(255, 255, 255, 0.90);
}

.taxpill:active {
  transform: translateY(1px);
}

.taxpill-prefix {
  color: rgba(90, 79, 130, 0.70);
  font-weight: 500;
}

.fixedbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

/* 固定バー用ボタン */
.fbtn {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  text-decoration: none;
  white-space: nowrap;
}

.fbtn:active {
  transform: translateY(1px);
}

.fbtn .ico {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.fbtn .txt-short {
  display: none;
}

@media (max-width: 560px) {
  .fixedbar-inner {
    padding: 7px 8px;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
  }

  .fixedbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 3px;
    align-items: center;
  }

  .fixedbar-label {
    display: inline;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .fixedbar-amountwrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
  }

  .fixedbar-amount {
    flex: 0 1 auto;
    min-width: 0;
    font-size: clamp(15px, 5vw, 22px);
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .taxpill {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 4px 7px;
  }

  .taxpill-prefix {
    display: none;
  }

  .fixedbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .fbtn {
    padding: 7px 9px;
    font-size: 12px;
    border-radius: 12px;
    gap: 5px;
  }

  .fbtn .ico {
    width: 14px;
    height: 14px;
  }

  .fixedbar-actions .fbtn:not(.primary) .txt {
    display: none;
  }

  .fixedbar-actions .fbtn.primary {
    padding: 7px 9px;
    font-size: 12px;
    min-width: auto;
  }

  .fbtn .txt-full {
    display: none;
  }

  .fbtn .txt-short {
    display: inline;
  }
}

@media print {

  .fixedbar,
  #fixedBarSpacer {
    display: none !important;
  }
}

/* ============================================================
   オプションパネル無効状態
   ============================================================ */

#optionPanel.is-disabled {
  opacity: .42;
  filter: grayscale(.10);
}

#optionPanel.is-disabled .panel-body::before {
  content: "ジャンルを選択してください（選択後にオプションが操作できます）";
  display: block;
  padding: 12px 14px;
  margin: 0 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.38);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

#optionPanel.is-disabled button,
#optionPanel.is-disabled input,
#optionPanel.is-disabled select,
#optionPanel.is-disabled label {
  pointer-events: none;
}

/* ============================================================
   SNSアプリ内ブラウザ対策（backdrop-filter非対応環境）
   ============================================================ */

body.no-blur .panel,
body.no-blur .badge,
body.no-blur .fixedbar,
body.no-blur #textModal .modal-card,
body.no-blur .toast {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.no-blur .panel,
body.no-blur .step,
body.no-blur .opt,
body.no-blur .badge,
body.no-blur .btn,
body.no-blur .fbtn,
body.no-blur .select,
body.no-blur .field {
  background: rgba(255, 255, 255, 0.94) !important;
}

body.no-blur .fixedbar {
  background: rgba(255, 255, 255, 0.96) !important;
}

.no-blur .panel.sticky {
  position: static !important;
  top: auto !important;
}

.no-blur .step-content {
  position: static !important;
  display: none !important;
}

.no-blur .step.open .step-content {
  display: block !important;
}

.no-blur .step-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   スクロールアンカー防止
   ============================================================ */

#stepsMount,
#optionPanel,
#summaryPanel,
#fixedBarSpacer {
  overflow-anchor: none;
}

.step,
.step-content,
.step-btn {
  overflow-anchor: none;
}

html,
body {
  overflow-anchor: none;
}

/* ============================================================
   プレビューステータスバー
   ============================================================ */

.preview-statusbar {
  display: none;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(200, 168, 80, 0.40);
  background: rgba(255, 248, 210, 0.65);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: #6b5500;
  font-size: 14px;
  line-height: 1.5;
}

.preview-statusbar.active {
  display: block;
}

.preview-statusbar .row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.preview-pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(200, 168, 80, 0.50);
  background: rgba(255, 240, 150, 0.70);
  font-weight: 700;
  font-size: 13px;
  color: #6b5500;
}

.preview-clear-btn {
  border: 1px solid rgba(192, 160, 48, 0.50);
  background: rgba(255, 255, 255, 0.65);
  color: #5a4800;
  border-radius: 10px;
  padding: 6px 11px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
}

.preview-error {
  display: none;
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(220, 60, 100, 0.28);
  background: rgba(255, 240, 245, 0.70);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: #8b1a3a;
  font-size: 14px;
  line-height: 1.5;
}

.preview-error.active {
  display: block;
}

/* ============================================================
   サイトフッター
   ============================================================ */

.site-footer {
  flex: 0 0 auto;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.40);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

.site-footer-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 16px 8px 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.site-footer-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.14s ease;
}

.site-footer-link:hover {
  text-decoration: underline;
  color: var(--main);
}

/* ============================================================
   補助文字・共通色
   ============================================================ */

.brand p,
.panel-head .sub,
.hint,
.step-title span,
.opt .desc,
.total .small,
.footer-note,
.fixedbar-label,
.site-footer-inner,
.preview-statusbar,
.preview-error {
  color: var(--muted);
}

.badge,
.price,
.pill {
  color: rgba(26, 19, 72, 0.88);
}

.hint,
.muted,
.panel-head .sub,
.step-title span,
.total .small,
.brand p,
.brand-company,
.topbar-sub,
.site-footer-inner {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 520px) {
  .wrap {
    width: 100%;
    padding: 10px 18px 60px;
  }

  .topbar {
    padding: 10px 14px;
    margin-bottom: 12px;
  }

  .brand {
    align-items: flex-start;
    gap: 10px;
  }

  .logo {
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    margin: 0;
    line-height: 1.15;
    font-size: 17px;
  }

  .topbar-sub {
    margin-top: 2px;
    line-height: 1.45;
  }

  .brand-company {
    margin-top: 2px;
    line-height: 1.4;
  }
}

/* ============================================================
   AIに尋ねてみる
   ============================================================ */

.summary-ai-wrap {
  margin-top: 12px;
  margin-bottom: 18px;
}

.ai-ask-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-direction: row-reverse;
}

.ai-ask-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  overflow: hidden;
}

.ai-ask-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.ai-ask-bubble {
  position: relative;
  display: block;
  width: 100%;
  flex: 1 1 auto;
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text);
  border-radius: 18px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.7;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.ai-ask-bubble:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 28px rgba(80, 60, 180, 0.14), var(--glass-inset);
}

.ai-ask-bubble:before {
  content: "";
  position: absolute;
  right: -12px;
  bottom: 18px;
  border-width: 10px 0 10px 12px;
  border-style: solid;
  border-color: transparent transparent transparent var(--glass-border);
}

.ai-ask-bubble:after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: 19px;
  border-width: 9px 0 9px 11px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.75);
}

.ai-ask-inline {
  color: var(--main);
  font-weight: 800;
  margin-left: 6px;
}

@media (max-width: 640px) {
  .ai-ask-avatar {
    width: 58px;
    height: 58px;
  }

  .ai-ask-bubble {
    font-size: 13px;
    padding: 12px 14px;
  }

  .summary-ai-wrap {
    margin-bottom: 14px;
  }
}

/* ============================================================
   フォーム切替バッジ
   ============================================================ */

.public-form-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--main);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.02em;
  box-shadow: var(--glass-shadow-sm), var(--glass-inset);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.10s ease;
}

.public-form-badge:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 20px rgba(80, 60, 180, 0.14), var(--glass-inset);
}

.public-form-badge:active {
  transform: translateY(1px);
}

/* ============================================================
   マイナス金額
   ============================================================ */

.price.is-negative,
#breakdownTable td.is-negative,
#finalBreakdownTable td.is-negative,
#monthlyText.is-negative,
#optText.is-negative,
#baseText.is-negative,
#totalText.is-negative,
#topTotalText.is-negative,
#finalTotalText.is-negative,
#finalBaseText.is-negative,
#finalOptText.is-negative,
#finalMonthlyText.is-negative {
  color: #d93025;
  font-weight: 700;
}

/* ============================================================
   qoptions：自動追加項目
   ============================================================ */

.opt.opt-qopt.is-auto {
  border-style: dashed;
  border-color: rgba(180, 160, 240, 0.45);
  background: rgba(240, 235, 255, 0.45);
}

.opt.opt-qopt.is-auto .left-badge {
  width: auto !important;
  min-width: 52px;
  margin-top: 0 !important;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.65);
  color: var(--main);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  opacity: 1 !important;
}

.opt.opt-qopt.is-auto .name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.opt.opt-qopt.is-auto .name::after {
  content: "自動追加";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.65);
  color: var(--main);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.opt.opt-qopt.is-auto .controls {
  display: none !important;
}

.opt.opt-qopt .auto-reason {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--main);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(180, 160, 240, 0.50);
  border-radius: 12px;
  padding: 8px 11px;
}

.opt.opt-qopt .help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.65);
  color: var(--main);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}

@media (max-width: 560px) {
  .opt.opt-qopt.is-auto .left-badge {
    min-width: 44px;
    font-size: 10px;
    padding: 2px 7px;
  }

  .opt.opt-qopt .auto-reason {
    font-size: 11px;
    padding: 7px 9px;
  }
}

@media (hover: none),
(pointer: coarse),
(max-width: 1024px) {
  .help-tip {
    display: none !important;
  }
}

/* ============================================================
   サンプル切替バッジ
   ============================================================ */

.topbar-right {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.public-sample-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(200, 138, 0, .34);
  background: linear-gradient(180deg, rgba(255, 246, 196, .98), rgba(255, 236, 162, .96));
  color: #6a4b00;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: .04em;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
}

.public-sample-badge:hover {
  filter: brightness(0.98);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .10);
}

.public-sample-badge:active {
  transform: translateY(1px);
}

@media (max-width: 640px) {
  .topbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .public-sample-badge {
    min-height: 34px;
    font-size: 13px;
    padding: 7px 12px;
  }
}