:root {
  color-scheme: light;
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #1c1917;
  background: #f5f5f4;
  --stone-950: #0c0a09;
  --stone-900: #1c1917;
  --stone-800: #292524;
  --stone-700: #44403c;
  --stone-600: #57534e;
  --stone-500: #78716c;
  --stone-400: #a8a29e;
  --stone-300: #d6d3d1;
  --stone-200: #e7e5e4;
  --stone-100: #f5f5f4;
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --amber-50: #fffbeb;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--stone-100); overflow-x: hidden; }
button { font: inherit; }

.app-shell { min-height: 100vh; background: var(--stone-100); }
.product-header { background: var(--stone-900); color: white; border-bottom: 1px solid var(--stone-800); }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand-block { min-width: 0; text-align: left; }
.brand-block h1 { margin: 0; font-size: 20px; line-height: 1.25; }
.brand-block h1 span { color: #fbbf24; font-size: 16px; font-weight: 600; margin-left: 5px; }
.brand-block p { margin: 4px 0 0; font-size: 13px; color: var(--stone-300); }
.company-block { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--stone-400); }
.spec-badge { background: rgba(41,37,36,.9); border: 1px solid var(--stone-700); border-radius: 6px; padding: 6px 9px; }
.company-name { text-align: right; white-space: nowrap; }
.company-name small { display: block; color: var(--stone-500); margin-top: 2px; }

.main-container { max-width: 1280px; margin: 0 auto; padding: 30px 24px 36px; }
.main-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(340px, 5fr); gap: 30px; align-items: start; }
.preview-column { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.control-column { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.preview-card, .panel, .selected-color-card { background: white; border: 1px solid var(--stone-200); border-radius: 13px; overflow: hidden; box-shadow: 0 1px 3px rgba(28,25,23,.06); }
.preview-toolbar { min-height: 64px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--stone-900); color: white; border-bottom: 1px solid var(--stone-800); }
.current-color-summary { display: flex; align-items: center; gap: 11px; min-width: 0; }
.toolbar-color-chip { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); flex: 0 0 auto; }
.current-color-summary strong { font-size: 15px; }
.current-color-summary small { display: block; margin-top: 3px; color: var(--stone-400); font-size: 11px; }
.toolbar-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.button { border: 1px solid transparent; border-radius: 6px; padding: 7px 10px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--amber-600); color: white; }
.button-primary:hover { background: var(--amber-500); }

.canvas-stage { position: relative; min-height: 420px; max-height: 620px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--stone-950); user-select: none; }
.canvas-zoom-wrapper { width: 100%; height: 100%; padding: 8px; display: flex; align-items: center; justify-content: center; transform-origin: center; transition: transform .18s ease-out; }
#simulation-canvas { display: block; max-width: 100%; max-height: 580px; width: auto; height: auto; border-radius: 6px; box-shadow: 0 18px 45px rgba(0,0,0,.4); }
.loading-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: white; background: rgba(12,10,9,.82); font-size: 12px; }
.loading-overlay[hidden] { display: none; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--amber-500); border-top-color: transparent; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-badge { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid rgba(87,83,78,.8); border-radius: 6px; color: var(--stone-200); background: rgba(28,25,23,.82); backdrop-filter: blur(7px); font-size: 11px; }
.result-badge > span:first-child { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.zoom-controls { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 3px; padding: 4px; border: 1px solid rgba(87,83,78,.8); border-radius: 8px; background: rgba(28,25,23,.82); backdrop-filter: blur(7px); }
.zoom-controls button { width: 30px; height: 29px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--stone-300); cursor: pointer; font-size: 18px; line-height: 1; }
.zoom-controls button:hover { color: white; background: var(--stone-800); }

.selected-color-card { padding: 13px 14px; display: flex; align-items: center; gap: 18px; }
.selected-color-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.detail-color-chip { width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--stone-200); flex: 0 0 auto; }
.selected-color-card small { color: var(--stone-500); display: block; font-size: 11px; margin-bottom: 3px; }
.selected-color-card strong { font-size: 15px; }
.selected-color-card em { color: var(--stone-400); font-size: 11px; font-style: normal; font-weight: 400; }

.panel { padding: 18px; }
.panel-heading { margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--stone-100); }
.panel-heading.compact { margin-bottom: 12px; }
.panel-heading h2, .spec-panel h2 { margin: 0; font-size: 16px; line-height: 1.4; }
.panel-heading p { margin: 4px 0 0; color: var(--stone-500); font-size: 12px; line-height: 1.55; }
.sample-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.sample-button { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; border: 1px solid var(--stone-200); border-radius: 11px; background: #fafaf9; cursor: pointer; text-align: center; transition: border .15s, box-shadow .15s, transform .15s; }
.sample-button:hover { border-color: var(--stone-300); transform: translateY(-1px); }
.sample-button.selected { border-color: var(--amber-600); box-shadow: 0 0 0 2px rgba(245,158,11,.35); }
.sample-button img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--stone-200); }
.sample-button span { min-height: 48px; width: 100%; padding: 10px 5px; display: grid; place-items: center; background: white; color: var(--stone-800); font-size: 12px; font-weight: 800; }
.sample-button.selected span { color: #78350f; }
.sample-check { position: absolute; top: 7px; right: 7px; width: 21px; height: 21px; display: none; place-items: center; border-radius: 50%; background: var(--amber-600); color: white; font-size: 13px; font-weight: 900; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.sample-button.selected .sample-check { display: grid; }

.color-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.color-button { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px; border: 1px solid var(--stone-200); border-radius: 8px; background: #fafaf9; cursor: pointer; text-align: left; transition: border .15s, background .15s, box-shadow .15s; }
.color-button:hover { border-color: var(--stone-300); background: var(--stone-100); }
.color-button.selected { border-color: var(--amber-500); background: var(--amber-50); box-shadow: 0 0 0 2px rgba(245,158,11,.26); }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.15); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.color-swatch i { display: none; width: 19px; height: 19px; border-radius: 50%; background: white; color: var(--stone-900); place-items: center; font-style: normal; font-size: 13px; font-weight: 900; }
.color-button.selected .color-swatch i { display: grid; }
.color-text { min-width: 0; flex: 1; }
.color-name-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.color-number { width: 15px; flex: 0 0 auto; color: var(--stone-400); font-size: 10px; font-weight: 700; }
.color-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--stone-800); font-size: 12px; font-weight: 800; }
.color-en-name { display: block; margin: 3px 0 0 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--stone-400); font-size: 10px; }
.color-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--stone-100); color: var(--stone-500); font-size: 10px; line-height: 1.6; }

.reason { display: flex; align-items: flex-start; gap: 11px; margin-top: 9px; padding: 11px; border: 1px solid var(--stone-200); border-radius: 9px; background: #fafaf9; }
.reason > b { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; color: white; background: var(--stone-700); font-size: 11px; }
.reason-amber { border-color: #fde68a; background: rgba(255,251,235,.7); }
.reason-amber > b { background: var(--amber-600); }
.reason-blue { border-color: #bae6fd; background: rgba(240,249,255,.75); }
.reason-blue > b { background: #0284c7; }
.reason span { min-width: 0; }
.reason strong { display: block; font-size: 12px; line-height: 1.45; }
.reason small { display: block; margin-top: 5px; color: var(--stone-600); font-size: 11px; line-height: 1.6; }
.spec-panel { padding: 16px; border: 1px solid var(--stone-200); border-radius: 12px; background: #fafaf9; color: var(--stone-700); }
.spec-panel h2 { font-size: 13px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.spec-grid div { padding: 9px; border: 1px solid var(--stone-200); border-radius: 6px; background: white; }
.spec-grid small { display: block; color: var(--stone-400); font-size: 10px; }
.spec-grid strong { display: block; margin-top: 2px; color: var(--stone-800); font-size: 11px; }
.spec-panel p { margin: 11px 0 0; font-size: 10px; line-height: 1.7; color: var(--stone-500); }

.app-footer { margin-top: 14px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--stone-900); color: var(--stone-300); text-align: center; }
.app-footer strong { font-size: 12px; }
.app-footer small { color: var(--stone-500); font-size: 10px; }

@media (max-width: 1100px) {
  .main-grid { grid-template-columns: minmax(0, 7fr) minmax(310px, 5fr); gap: 20px; }
  .color-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .spec-badge { display: none; }
}

@media (max-width: 850px) {
  .header-inner { align-items: flex-start; }
  .company-block { display: none; }
  .main-container { padding: 18px 14px 26px; }
  .main-grid { display: block; }
  .preview-column { position: static; }
  .control-column { margin-top: 20px; }
  .canvas-stage { min-height: 360px; }
}

@media (max-width: 600px) {
  .header-inner { padding: 12px; }
  .brand-block h1 { font-size: 16px; }
  .brand-block h1 span { display: block; margin: 2px 0 0; font-size: 13px; }
  .brand-block p { font-size: 11px; }
  .main-container { padding: 12px 8px 22px; }
  .preview-toolbar { align-items: flex-start; padding: 10px; }
  .current-color-summary strong { font-size: 13px; }
  .toolbar-actions { flex-direction: column; }
  .button { padding: 6px 8px; font-size: 10px; }
  .canvas-stage { min-height: 290px; }
  .canvas-zoom-wrapper { padding: 4px; }
  .result-badge { max-width: calc(100% - 94px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .selected-color-card { padding: 11px; }
  .detail-color-chip { width: 36px; height: 36px; }
  .selected-color-card strong { font-size: 13px; }
  .sample-grid { grid-template-columns: 1fr; }
  .sample-button { flex-direction: row; align-items: stretch; text-align: left; }
  .sample-button img { width: 40%; aspect-ratio: 4 / 3; }
  .sample-button span { min-height: 72px; justify-content: start; padding-left: 14px; }
  .color-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .color-button { gap: 6px; padding: 6px; }
  .color-swatch { width: 32px; height: 32px; }
  .color-name { font-size: 11px; }
  .color-en-name { display: none; }
  .panel { padding: 14px; }
}
