:root {
  --bg-page: #f0f4f9;
  --bg-deco-gradient: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 50%, #ffedd5 100%);
  --surface-card: #ffffff;
  --surface-row: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-input: #ffffff;
  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;
  --top-bar-gradient: linear-gradient(90deg, var(--left-primary) 0%, #8b5cf6 50%, var(--right-primary) 100%);
  --accordion-bg: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  --track-bg: #e2e8f0;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Dual Pole Colors: Left (Warm/Dynamic) vs Right (Cool/Analytical) */
  --left-primary: #f97316;
  --left-soft: #fff7ed;
  --left-border: #fed7aa;
  --left-text: #c2410c;

  --right-primary: #0284c7;
  --right-soft: #f0f9ff;
  --right-border: #bae6fd;
  --right-text: #0369a1;

  --accent-primary: #3b82f6;
  --accent-indigo: #4f46e5;
  --accent-teal: #0d9488;
  --stamp-color: #ef4444;
  --stamp-bg: transparent;

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-card: 0 12px 32px -8px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

/* Theme 2: Checkup Mint (健診ミント) */
body[data-theme="mint"] {
  --bg-page: #ecfdf5;
  --bg-deco-gradient: linear-gradient(135deg, #d1fae5 0%, #ccfbf1 50%, #e0f2fe 100%);
  --surface-card: #ffffff;
  --surface-row: #ffffff;
  --surface-subtle: #f0fdf4;
  --surface-input: #ffffff;
  --border-light: #bbf7d0;
  --border-strong: #86efac;
  --top-bar-gradient: linear-gradient(90deg, #10b981 0%, #14b8a6 50%, #0284c7 100%);
  --accordion-bg: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
  --track-bg: #d1fae5;
  --accent-indigo: #0d9488;
}

/* Theme 3: Pastel Sakura (パステル桜) */
body[data-theme="sakura"] {
  --bg-page: #fff1f2;
  --bg-deco-gradient: linear-gradient(135deg, #ffe4e6 0%, #fce7f3 50%, #fae8ff 100%);
  --surface-card: #ffffff;
  --surface-row: #ffffff;
  --surface-subtle: #fff5f7;
  --surface-input: #ffffff;
  --border-light: #fecdd3;
  --border-strong: #fda4af;
  --top-bar-gradient: linear-gradient(90deg, #fb7185 0%, #ec4899 50%, #a855f7 100%);
  --accordion-bg: linear-gradient(135deg, #fff1f2 0%, #fdf4ff 100%);
  --track-bg: #ffe4e6;
  --accent-indigo: #db2777;
}

/* Theme: Muted Sage (くすみセージ) */
body[data-theme="sage"] {
  --bg-page: #f2f5f1;
  --bg-deco-gradient: linear-gradient(135deg, #d8e2dc 0%, #e8ede6 50%, #dfe7e2 100%);
  --surface-card: #ffffff;
  --surface-row: #f5f7f3;
  --surface-subtle: #ebf0ea;
  --surface-input: #ffffff;
  --border-light: #cbd5c8;
  --border-strong: #b0bfac;
  --top-bar-gradient: linear-gradient(90deg, #84a98c 0%, #52796f 50%, #354f52 100%);
  --accordion-bg: linear-gradient(135deg, #f5f7f3 0%, #ebf0ea 100%);
  --track-bg: #dfe5dc;
  --text-main: #283618;
  --text-secondary: #475b36;
  --text-muted: #6f835e;
  --accent-indigo: #52796f;
}

/* Theme 5: Ocean Blue (オーシャンブルー) */
body[data-theme="ocean"] {
  --bg-page: #f0f9ff;
  --bg-deco-gradient: linear-gradient(135deg, #bae6fd 0%, #e0f2fe 50%, #cffafe 100%);
  --surface-card: #ffffff;
  --surface-row: #ffffff;
  --surface-subtle: #f0f9ff;
  --surface-input: #ffffff;
  --border-light: #bae6fd;
  --border-strong: #7dd3fc;
  --top-bar-gradient: linear-gradient(90deg, #06b6d4 0%, #0284c7 50%, #2563eb 100%);
  --accordion-bg: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
  --track-bg: #e0f2fe;
  --accent-indigo: #0284c7;
}

/* Theme 7: Retro Chart / Warm Paper (レトロカルテ) */
body[data-theme="amber"] {
  --bg-page: #f5ebe0;
  --bg-deco-gradient: linear-gradient(135deg, #fef3c7 0%, #ffedd5 50%, #e7e5e4 100%);
  --surface-card: #fffdf9;
  --surface-row: #fffaf2;
  --surface-subtle: #f5f0e6;
  --surface-input: #ffffff;
  --border-light: #e6ccb2;
  --border-strong: #d4a373;
  --top-bar-gradient: linear-gradient(90deg, #d97706 0%, #b45309 50%, #0f766e 100%);
  --accordion-bg: linear-gradient(135deg, #fef3c7 0%, #f5f0e6 100%);
  --track-bg: #e6ccb2;
  --text-main: #292524;
  --text-secondary: #57534e;
  --text-muted: #78716c;
  --accent-indigo: #b45309;
}

/* Theme 8: Gaming Cyber Dark (ゲーミングダーク) */
body[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-deco-gradient: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #042f2e 100%);
  --surface-card: #111827;
  --surface-row: #1e293b;
  --surface-subtle: #1f2937;
  --surface-input: #0f172a;
  --border-light: #334155;
  --border-strong: #475569;
  --top-bar-gradient: linear-gradient(90deg, #f97316 0%, #8b5cf6 50%, #06b6d4 100%);
  --accordion-bg: linear-gradient(135deg, #1e293b 0%, #1e1b4b 100%);
  --track-bg: #334155;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --left-primary: #fb923c;
  --left-soft: rgba(249, 115, 22, 0.16);
  --left-border: rgba(251, 146, 60, 0.45);
  --left-text: #fdba74;

  --right-primary: #38bdf8;
  --right-soft: rgba(56, 189, 248, 0.16);
  --right-border: rgba(56, 189, 248, 0.45);
  --right-text: #7dd3fc;

  --accent-indigo: #818cf8;
  --stamp-color: #f87171;
  --stamp-bg: transparent;
  --shadow-card: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
}

/* Theme 9: Midnight Neon (ミッドナイトネオン) */
body[data-theme="midnight"] {
  --bg-page: #11091c;
  --bg-deco-gradient: linear-gradient(135deg, #3b0764 0%, #1e1b4b 50%, #4c0519 100%);
  --surface-card: #1a102a;
  --surface-row: #25173a;
  --surface-subtle: #2d1b46;
  --surface-input: #140c21;
  --border-light: #442868;
  --border-strong: #613991;
  --top-bar-gradient: linear-gradient(90deg, #f43f5e 0%, #d946ef 50%, #8b5cf6 100%);
  --accordion-bg: linear-gradient(135deg, #25173a 0%, #311542 100%);
  --track-bg: #442868;

  --text-main: #fdf4ff;
  --text-secondary: #e9d5ff;
  --text-muted: #c084fc;

  --left-primary: #fb923c;
  --left-soft: rgba(249, 115, 22, 0.18);
  --left-border: rgba(251, 146, 60, 0.48);
  --left-text: #fdba74;

  --right-primary: #38bdf8;
  --right-soft: rgba(56, 189, 248, 0.18);
  --right-border: rgba(56, 189, 248, 0.48);
  --right-text: #7dd3fc;

  --accent-indigo: #e879f9;
  --stamp-color: #fb7185;
  --stamp-bg: transparent;
  --shadow-card: 0 16px 40px -8px rgba(0, 0, 0, 0.65);
}

/* Theme 10: Stealth OLED (ステルスOLED) */
body[data-theme="stealth"] {
  --bg-page: #000000;
  --bg-deco-gradient: linear-gradient(135deg, #171717 0%, #0a0a0a 50%, #1f2937 100%);
  --surface-card: #0a0a0a;
  --surface-row: #141414;
  --surface-subtle: #1a1a1a;
  --surface-input: #050505;
  --border-light: #262626;
  --border-strong: #404040;
  --top-bar-gradient: linear-gradient(90deg, #525252 0%, #a3a3a3 50%, #ffffff 100%);
  --accordion-bg: linear-gradient(135deg, #141414 0%, #0a0a0a 100%);
  --track-bg: #262626;

  --text-main: #ffffff;
  --text-secondary: #e5e5e5;
  --text-muted: #a3a3a3;

  --left-primary: #fb923c;
  --left-soft: rgba(249, 115, 22, 0.18);
  --left-border: rgba(251, 146, 60, 0.45);
  --left-text: #fdba74;

  --right-primary: #38bdf8;
  --right-soft: rgba(56, 189, 248, 0.18);
  --right-border: rgba(56, 189, 248, 0.45);
  --right-text: #7dd3fc;

  --accent-indigo: #38bdf8;
  --stamp-color: #f87171;
  --stamp-bg: transparent;
  --shadow-card: 0 16px 40px -8px rgba(0, 0, 0, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px 16px 60px;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 340px;
  background: var(--bg-deco-gradient);
  opacity: 0.65;
  z-index: -1;
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Top Toolbar */
.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

body[data-theme="dark"] .app-toolbar,
body[data-theme="midnight"] .app-toolbar,
body[data-theme="stealth"] .app-toolbar {
  background: rgba(30, 41, 59, 0.88);
  border-color: var(--border-light);
}

body[data-theme="stealth"] .app-toolbar {
  background: rgba(15, 15, 15, 0.92);
}

.toolbar-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

/* Theme Picker Swatches */
.theme-picker {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: 8px;
}

.theme-picker-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-right: 3px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.theme-swatch:hover {
  transform: scale(1.12);
}

.theme-swatch.active {
  border-color: var(--text-main);
  transform: scale(1.1);
}

.swatch-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.swatch-standard {
  background: linear-gradient(135deg, #3b82f6 50%, #f97316 50%);
}

.swatch-mint {
  background: linear-gradient(135deg, #10b981 50%, #ecfdf5 50%);
}

.swatch-sakura {
  background: linear-gradient(135deg, #ec4899 50%, #fff1f2 50%);
}

.swatch-sage {
  background: linear-gradient(135deg, #52796f 50%, #d8e2dc 50%);
}

.swatch-ocean {
  background: linear-gradient(135deg, #0284c7 50%, #e0f2fe 50%);
}

.swatch-amber {
  background: linear-gradient(135deg, #d97706 50%, #f5ebe0 50%);
}

.swatch-dark {
  background: linear-gradient(135deg, #111827 50%, #818cf8 50%);
}

.swatch-midnight {
  background: linear-gradient(135deg, #1a102a 50%, #e879f9 50%);
}

.swatch-stealth {
  background: linear-gradient(135deg, #050505 50%, #e5e5e5 50%);
}

/* Language Switch */
.lang-switch {
  display: inline-flex;
  background: var(--border-light);
  padding: 3px;
  border-radius: 8px;
}

.lang-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lang-btn.active {
  background: var(--surface-card);
  color: var(--accent-indigo);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

/* Main Checkup Sheet Card */
.checkup-sheet {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--border-light);
  padding: 28px 32px 22px;
  position: relative;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.checkup-sheet::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--top-bar-gradient);
}

/* Sheet Header */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--text-main);
  margin-bottom: 18px;
}

.sheet-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-main);
}

.sheet-subtitle {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sheet-date-box {
  text-align: right;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  min-width: 118px;
}

.date-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.date-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Examinee Profile Bar */
.profile-section {
  display: grid;
  grid-template-columns: 1.1fr 2.3fr;
  gap: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 22px;
  width: 100%;
  box-sizing: border-box;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.profile-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-field input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--surface-input);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-field input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-field input:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Checkup Items Section & Pattern A Category Headers */
.sliders-container {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 24px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-strong);
  margin-top: 4px;
  margin-bottom: 2px;
}

.category-header:not(:first-child) {
  margin-top: 14px;
}

.category-badge {
  font-family: 'Inter', 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-indigo);
  background: var(--surface-subtle);
  border: 1.5px solid var(--border-strong);
  padding: 2px 9px;
  border-radius: 6px;
}

.category-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

/* Individual Checkup Item Row */
.checkup-row {
  background: var(--surface-row);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 13px 18px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  position: relative;
}

.checkup-row:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.item-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  padding: 2px 7px;
  border-radius: 4px;
}

.item-name {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
}

.item-status-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: 'Noto Sans JP', sans-serif;
  transition: all 0.2s ease;
}

.status-left {
  background: var(--left-soft);
  color: var(--left-text);
  border: 1px solid var(--left-border);
}

.status-right {
  background: var(--right-soft);
  color: var(--right-text);
  border: 1px solid var(--right-border);
}

.status-center {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

/* Poles & Slider Layout: Left ~25%, Seekbar ~50%, Right ~25% */
.poles-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 14px;
}

.pole-box {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.pole-left {
  text-align: left;
  color: var(--text-secondary);
  background: var(--surface-subtle);
}

.pole-right {
  text-align: right;
  color: var(--text-secondary);
  background: var(--surface-subtle);
}

.pole-left.active-pole {
  background: var(--left-soft);
  color: var(--left-text);
  border-color: var(--left-border);
  font-weight: 800;
}

.pole-right.active-pole {
  background: var(--right-soft);
  color: var(--right-text);
  border-color: var(--right-border);
  font-weight: 800;
}

.pole-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 1px;
}

/* Custom Seekbar Track Area */
.seekbar-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 0;
}

.track-visual {
  position: relative;
  height: 12px;
  background: var(--track-bg);
  border-radius: 999px;
  overflow: hidden;
}

/* Center Reference Line */
.track-center-mark {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-muted);
  opacity: 0.6;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

/* Dynamic Fill from Center (50%) to Left or Right */
.track-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.08s ease, left 0.08s ease, background 0.2s ease;
}

/* Step Ticks Overlay */
.track-ticks {
  position: absolute;
  top: 50%;
  left: 10px;
  right: 10px;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

.tick-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.35;
  transition: transform 0.15s, background 0.15s;
}

.tick-dot.tick-center {
  width: 7px;
  height: 7px;
  opacity: 0.65;
}

/* Native Range Input styled over track */
.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  margin: 0;
  z-index: 4;
  cursor: grab;
}

.range-input:active {
  cursor: grabbing;
}

.range-input:focus {
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--thumb-color, var(--accent-indigo));
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

.range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--thumb-color, var(--accent-indigo));
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

/* Comprehensive Diagnosis Accordion (Collapsible, Default Collapsed) */
.diagnosis-accordion {
  background: var(--accordion-bg);
  border: 2px solid var(--accent-indigo);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.diagnosis-accordion[open] {
  border: 1.5px solid var(--border-strong);
  box-shadow: none;
}

.diagnosis-accordion:not([open]):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.22);
}

.diagnosis-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.diagnosis-summary::-webkit-details-marker {
  display: none;
}

.diagnosis-summary:hover {
  background: rgba(79, 70, 229, 0.06);
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.summary-hint {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-indigo), var(--right-primary));
  padding: 6px 18px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.diagnosis-summary:hover .summary-hint {
  transform: scale(1.03);
  box-shadow: 0 5px 14px rgba(79, 70, 229, 0.4);
}

.diagnosis-accordion[open] .summary-hint {
  display: none;
}

.accordion-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1.5px solid var(--accent-indigo);
  font-size: 0.85rem;
  color: var(--accent-indigo);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s ease, background 0.15s ease;
}

.diagnosis-accordion[open] .accordion-chevron {
  transform: rotate(180deg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.diagnosis-accordion[open] .diagnosis-summary {
  border-bottom: 1px solid var(--border-light);
}

/* Comprehensive Diagnosis Result Panel */
.diagnosis-result-panel {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 18px 20px 20px;
  align-items: stretch;
}

.diagnosis-left {
  display: flex;
  flex-direction: column;
}

.diagnosis-share-area {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.share-pc-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.result-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.result-badge {
  background: var(--text-main);
  color: var(--surface-card);
  font-size: 0.94rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 7px;
  letter-spacing: 0.04em;
}

.type-code-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-indigo);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 5px;
}

.type-catch {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-indigo);
  margin-bottom: 2px;
}

.type-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 10px;
}

.type-description {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trait-tag {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
}

/* Right Chart & Medical Stamp */
.diagnosis-right {
  display: flex;
  justify-content: center;
}

.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px 36px;
  min-height: 308px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
}

.chart-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 2px;
  letter-spacing: 0.04em;
  align-self: center;
  text-align: center;
}

#balanceCanvas {
  margin-left: -4px;
  margin-top: 2px;
}

/* Hanko / Medical Stamp style (Enlarged, Bottom-Right) */
.stamp-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 102px;
  height: 102px;
  border: 3.5px solid var(--stamp-color);
  border-radius: 50%;
  color: var(--stamp-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-14deg);
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

.stamp-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  text-align: center;
}

.stamp-top,
.stamp-bottom {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.stamp-main {
  width: 96%;
  display: block;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  border-top: 2px solid var(--stamp-color);
  border-bottom: 2px solid var(--stamp-color);
  padding: 3px 2px;
  margin: 3px 0;
}

/* Sheet Footer */
.sheet-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Bottom Action Bar */
.action-bar {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--right-primary));
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 13px 24px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(79, 70, 229, 0.55);
}

.btn-share-x {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 13px 22px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-share-x:hover {
  background: #1e293b;
  transform: translateY(-2px);
}

.btn-copy-url {
  padding: 12px 18px;
  font-size: 0.88rem;
  border-radius: 12px;
}

/* Page Footer / Creator Credit */
.page-credit {
  margin-top: 26px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.page-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.page-credit a:hover {
  color: var(--accent-indigo);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive Adjustments (Tablet & Smartphone) */
@media (max-width: 768px) {
  body {
    padding: 12px 10px 44px;
  }

  .app-toolbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .btn-secondary {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .checkup-sheet {
    padding: 20px 14px 16px;
    border-radius: 16px;
  }

  .sheet-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
  }

  .sheet-title {
    font-size: 1.55rem;
  }

  .sheet-subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .sheet-date-box {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    min-width: auto;
  }

  .date-label {
    display: inline;
  }

  .date-value {
    font-size: 0.85rem;
  }

  .profile-section {
    grid-template-columns: 1fr;
    padding: 10px 12px;
    gap: 10px;
    margin-bottom: 18px;
    width: 100%;
    box-sizing: border-box;
  }

  .profile-field {
    min-width: 0;
    width: 100%;
  }

  /* 16px prevents iOS Safari auto-zoom when tapping text inputs */
  .profile-field input {
    font-size: 16px;
    padding: 8px 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .category-header {
    gap: 8px;
    padding-bottom: 6px;
  }

  .category-title {
    font-size: 0.94rem;
  }

  .checkup-row {
    padding: 11px 12px 13px;
  }

  .row-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .item-name {
    font-size: 0.9rem;
  }

  .item-status-pill {
    font-size: 0.7rem;
    padding: 2px 8px;
  }

  .poles-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }

  .pole-box {
    font-size: 0.76rem;
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .pole-left {
    order: 1;
  }

  .pole-right {
    order: 2;
  }

  .seekbar-wrapper {
    grid-column: 1 / -1;
    order: 3;
    padding: 10px 2px 4px;
  }

  .range-input {
    height: 34px;
    touch-action: pan-y;
  }

  .range-input::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
  }

  .range-input::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }

  .diagnosis-summary {
    padding: 12px 14px;
  }

  .diagnosis-result-panel {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px 14px 16px;
  }

  .type-title {
    font-size: 1.24rem;
  }

  .type-description {
    font-size: 0.83rem;
  }

  .diagnosis-share-area {
    margin-top: 14px;
    padding-top: 0;
  }

  .diagnosis-share-area .btn-share-x {
    width: 100%;
    justify-content: center;
  }

  .share-pc-hint {
    display: none !important;
  }

  .chart-card {
    padding: 10px 12px 52px;
    min-height: 310px;
    overflow: hidden;
  }

  #balanceCanvas {
    max-width: calc(100% + 20px);
    height: auto !important;
    margin-left: -12px;
  }

  .stamp-badge {
    bottom: 8px;
    right: 10px;
    transform: rotate(-14deg) scale(0.92);
  }

  .sheet-footer {
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.68rem;
    gap: 4px;
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

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

  .page-credit {
    margin-top: 20px;
    font-size: 0.76rem;
  }

  .toast {
    width: calc(100% - 24px);
    max-width: 360px;
    text-align: center;
    font-size: 0.8rem;
    padding: 10px 14px;
  }
}

@media (max-width: 400px) {
  .sheet-title {
    font-size: 1.35rem;
  }

  .pole-box {
    font-size: 0.72rem;
    padding: 6px 7px;
  }

  .stamp-badge {
    bottom: 6px;
    right: 6px;
    transform: rotate(-14deg) scale(0.84);
  }
}

