:root {
  --ink: #14233c;
  --muted: #63728a;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --line: #dce4f0;
  --blue: #246bfe;
  --blue-dark: #1351d1;
  --cyan: #1cb4c9;
  --orange: #ee8a2d;
  --violet: #9659d6;
  --green: #138b67;
  --shadow: 0 18px 45px rgba(25, 48, 83, 0.1);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 92% 0%, #e4efff 0, transparent 29rem), var(--canvas);
  font: 15px/1.48 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.site-header, main, footer { max-width: 1440px; margin-inline: auto; }
.site-header {
  min-height: 132px;
  padding: 28px 30px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.75rem, 3.2vw, 2.45rem); letter-spacing: -0.045em; }
h2 { margin-bottom: 5px; font-size: 1.05rem; letter-spacing: -0.02em; }
.subtitle, .help-text, .table-card p, .result-status { color: var(--muted); margin-bottom: 0; }
.eyebrow { color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .13em; margin-bottom: 5px; }

main { padding: 0 30px 48px; }
.workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.control-panel, .viewer-panel, .results, .table-card, .point-lists, .progress-section {
  background: rgba(255,255,255,.91); border: 1px solid rgba(220, 228, 240, .95); border-radius: 17px; box-shadow: var(--shadow);
}
.control-panel { overflow: hidden; }
.panel-section { padding: 24px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); }
.section-heading, .viewer-toolbar, .results-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.input-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: 12px; }
.text-button, .quiet-button { border: 0; color: var(--blue); background: transparent; font-weight: 750; padding: 5px 0; }
.quiet-button { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: #fff; }
.quiet-button:hover { border-color: var(--blue); }

.vertex-inputs { display: grid; gap: 9px; margin-top: 18px; }
.vertex-row { display: grid; grid-template-columns: 29px repeat(3, 1fr); align-items: center; gap: 7px; }
.vertex-name { color: var(--blue); font-weight: 800; font-size: .91rem; }
.coordinate-field { min-width: 0; }
.coordinate-field label { display: block; color: var(--muted); font-size: .68rem; font-weight: 700; margin: 0 0 2px 4px; }
.coordinate-field input { width: 100%; min-width: 0; color: var(--ink); background: #f8faff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; outline: none; font-variant-numeric: tabular-nums; }
.coordinate-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,107,254,.12); }
.candidate-info { margin-top: 17px; padding: 10px 11px; background: #edf4ff; border-radius: 8px; color: #34517b; font-size: .82rem; }
.message { margin-top: 12px; padding: 10px 11px; border-radius: 8px; font-size: .82rem; }
.error { color: #a83737; background: #fff0ef; }
.warning { color: #80531f; background: #fff6e7; }
.success { color: #176b50; background: #eaf9f2; }
.actions { display: flex; gap: 9px; margin-top: 14px; }
.primary-button, .secondary-button { border-radius: 9px; padding: 10px 15px; font-weight: 750; }
.primary-button { color: #fff; background: var(--blue); border: 1px solid var(--blue); box-shadow: 0 6px 14px rgba(36,107,254,.22); }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.scale-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scale-heading h2 { margin-bottom: 0; }
.scale-heading output { color: var(--blue); background: #edf4ff; border-radius: 7px; padding: 4px 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.scale-slider { width: 100%; margin: 22px 0 4px; accent-color: var(--blue); cursor: pointer; }
.scale-ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.scale-section .help-text { margin-top: 16px; font-size: .85rem; }
.subdivision-toggle { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: var(--ink); font-size: .84rem; font-weight: 700; cursor: pointer; }
.subdivision-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }

.viewer-panel { min-height: 585px; display: flex; flex-direction: column; padding: 20px; overflow: hidden; }
.viewer-toolbar { align-items: center; padding: 0 3px 15px; }
.viewer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.fullscreen-button { padding: 6px 9px; font-size: .8rem; }
.select-label { display: grid; grid-template-columns: auto auto; gap: 7px; align-items: center; color: var(--muted); font-size: .8rem; font-weight: 700; }
select { color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px; }
.scene-container { position: relative; min-height: 420px; flex: 1; overflow: hidden; border-radius: 12px; background: linear-gradient(145deg, #edf5ff, #f9fbff); }
.scene-container canvas { display: block; width: 100%; height: 100%; }
.viewer-panel:fullscreen, .viewer-panel:-webkit-full-screen { width: 100vw; height: 100vh; min-height: 0; max-width: none; padding: 22px; border: 0; border-radius: 0; background: #f5f9ff; }.viewer-panel:fullscreen .scene-container, .viewer-panel:-webkit-full-screen .scene-container { min-height: 0; }
.scene-notice { position: absolute; z-index: 2; top: 12px; left: 12px; max-width: calc(100% - 24px); color: #49627f; background: rgba(255,255,255,.8); border-radius: 7px; padding: 6px 9px; font-size: .75rem; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 13px 4px 0; color: var(--muted); font-size: .77rem; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }.interior-dot{background:var(--blue)}.face-dot{background:var(--cyan)}.edge-dot{background:var(--orange)}.vertex-dot{background:var(--violet)}

.progress-section { margin-top: 20px; padding: 15px 18px; }.progress-label { display: flex; justify-content: space-between; gap: 14px; font-size: .85rem; font-weight: 700; }.progress-track { overflow: hidden; height: 7px; margin-top: 9px; background: #e8eef7; border-radius: 50px; }.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .15s ease; }
.results, .point-lists { margin-top: 20px; padding: 24px; }.results-heading { align-items: end; }.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 11px; margin-top: 20px; }.stat-card { min-width: 0; position: relative; overflow: hidden; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdff; }.stat-card::before { content:""; position:absolute; inset:0 auto 0 0; width: 4px; }.accent-interior::before{background:var(--blue)}.accent-face::before{background:var(--cyan)}.accent-edge::before{background:var(--orange)}.accent-vertex::before{background:var(--violet)}.total-card::before{background:var(--green)}.stat-card span { display:block; color:var(--muted); font-size:.75rem; }.stat-card strong { display:block; margin-top:4px; font-size:1.36rem; letter-spacing:-.04em; font-variant-numeric:tabular-nums; }.total-card { background: #f2faf7; }.meta-grid { display:flex; flex-wrap:wrap; gap: 8px 23px; margin-top:17px; color:var(--muted); font-size:.82rem; }.meta-grid strong { color:var(--ink); font-variant-numeric:tabular-nums; }.results .message { margin-bottom:0; }
.detail-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:20px; margin-top:20px; }.table-card { padding:21px; }.table-card p { min-height: 40px; font-size:.83rem; }table { width:100%; border-collapse:collapse; }th, td { padding:10px 6px; text-align:left; border-top:1px solid var(--line); }th { color:var(--muted); font-size:.7rem; letter-spacing:.06em; text-transform:uppercase; }td:last-child, th:last-child { text-align:right; font-variant-numeric:tabular-nums; }
.point-lists { margin-top:20px; }.point-list-details { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:18px; }.point-list-details details { border:1px solid var(--line); border-radius:9px; padding:9px 11px; }.point-list-details summary { cursor:pointer; font-weight:700; }.point-list-details pre { max-height:250px; overflow:auto; white-space:pre-wrap; color:#42516b; font: .75rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.subdivision-results { margin-top:20px; padding:24px; background:rgba(255,255,255,.91); border:1px solid rgba(220, 228, 240, .95); border-radius:17px; box-shadow:var(--shadow); }.subdivision-intro { margin:17px 0 8px; color:var(--muted); font-size:.84rem; }.shape-legend { display:flex; flex-wrap:wrap; gap:15px; margin:13px 0 16px; color:var(--muted); font-size:.78rem; }.shape-legend span { display:inline-flex; align-items:center; gap:6px; }.shape-chip { width:10px; height:10px; border-radius:3px; display:inline-block; }.upright-chip{background:#4d7ff4}.octahedron-chip{background:#f4a340}.inverted-chip{background:#b85ad7}
footer { padding: 0 30px 25px; color:var(--muted); font-size:.76rem; text-align:center; }
@media (max-width: 980px) { .workspace { grid-template-columns:1fr; }.viewer-panel { min-height:520px; }.stat-grid { grid-template-columns:repeat(3,1fr); } }
@media (max-width: 620px) { .site-header, main { padding-inline:16px; }.site-header { min-height:0; align-items:flex-start; }.site-header .quiet-button { margin-top:5px; }.viewer-panel { padding:13px; min-height:450px; }.viewer-toolbar { align-items:flex-start; flex-direction:column; }.viewer-actions { justify-content:flex-start; }.select-label { grid-template-columns:auto 1fr; }.scene-container { min-height:340px; }.stat-grid { grid-template-columns:repeat(2,1fr); }.detail-grid, .point-list-details { grid-template-columns:1fr; }.results, .point-lists, .panel-section { padding:18px; }.vertex-row { grid-template-columns:24px repeat(3,1fr); gap:5px; }.coordinate-field input { padding:7px 5px; }.section-heading { flex-direction:column; }.input-buttons { justify-content:flex-start; } }
