/* =============================================
   simulations.css — shared styles for all sim pages
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #ffffff;
  --surface:  #ffffff;
  --surface2: #f6f7f8;
  --border:   #e3e4e8;
  --accent:   #111827;
  --accent2:  #c2410c;
  --accent3:  #7c3aed;
  --text:     #1a1a1a;
  --muted:    #6b7280;
  --success:  #15803d;
  --warn:     #b45309;
  --radius:   10px;
  --radius-sm: 6px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a { cursor: pointer; }

/* ── HEADER ── */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.header-logo {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .05em;
  text-decoration: none;
}
.header-logo:hover { text-decoration: none; color: #1d4ed8; }

.header nav { flex: 1; }

.header-nav {
  list-style: none;
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.header-nav li { display: inline; }
.header-nav a {
  color: var(--muted);
  font-size: .88rem;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  text-decoration: none;
  display: inline-block;
}
.header-nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.header-nav a.active { color: var(--accent); background: rgba(17,24,39,.08); }

.breadcrumb {
  margin-left: auto;
  font-size: .82rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }

/* ── MAIN WRAPPER ── */
.page-wrap {
  flex: 1;
  padding: 2rem 2rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .35rem;
  color: var(--text);
}
.page-sub {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 1.5rem;
}

/* ── SIM LAYOUT ── */
.sim-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 860px) {
  .sim-layout { grid-template-columns: 1fr; }
  .sim-sidebar { display: none; }
}

.sim-main { display: flex; flex-direction: column; gap: 1rem; }

/* ── SIDEBAR ── */
.sim-sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.sidebar-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.sidebar-block h3 {
  font-size: .78rem;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .6rem;
}
.sidebar-block ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sidebar-block li a {
  color: var(--muted);
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sidebar-block li a:hover { color: var(--text); }
.sidebar-block li a .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.sidebar-block li a:hover .dot { background: var(--accent); }

/* ── PANEL / CARD ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.panel-title {
  font-size: .82rem;
  font-family: 'Courier New', monospace;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

/* ── PRESET / TAB ROW ── */
.preset-row {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.preset-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.preset-btn:hover { border-color: var(--accent); color: var(--text); }
.preset-btn.active {
  background: rgba(17,24,39,.06);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── CTRL GRID / BLOCK / ROW ── */
.ctrl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: .5rem;
}
.ctrl-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.ctrl-block h3 {
  font-size: .82rem;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  margin-bottom: .75rem;
  letter-spacing: .04em;
}
.ctrl-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
}
.ctrl-row:last-child { margin-bottom: 0; }
.ctrl-label {
  font-size: .82rem;
  color: var(--muted);
  min-width: 52px;
  flex-shrink: 0;
}
.ctrl-row input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
  min-width: 0;
}
.ctrl-value {
  font-family: 'Courier New', monospace;
  font-size: .88rem;
  color: var(--accent);
  min-width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* ── BUTTONS ── */
.btn-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}
.btn {
  padding: .5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  line-height: 1.4;
}
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #000000; border-color: #000000; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); }
.btn-secondary {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── RESULT ── */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
}
.result-label {
  font-size: .78rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}
.result-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  line-height: 1.2;
}
.result-unit {
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
}
.result-note {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* ── CHART ── */
.chart-wrap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: .75rem;
}
.chart-header {
  padding: .5rem .75rem;
  background: rgba(0,0,0,.3);
  font-size: .78rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.chart-header span:last-child { color: var(--accent); }
.chart-wrap canvas { display: block; width: 100%; }

/* ── INFO BOX ── */
.info-box {
  background: rgba(17,24,39,.04);
  border: 1px solid rgba(17,24,39,.12);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.7;
}
.info-box strong { color: var(--text); }
.formula {
  font-family: 'Courier New', monospace;
  color: var(--accent3);
  background: rgba(124,58,237,.08);
  padding: .1rem .35rem;
  border-radius: 3px;
  font-size: .9em;
}

/* ── DATA TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin-top: .75rem;
}
.data-table th {
  text-align: left;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid rgba(0,0,0,.1);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.num { font-family: 'Courier New', monospace; color: var(--accent); }

/* ── SIM GALLERY (simulations.html) ── */
.sim-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}
.sim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.sim-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(17,24,39,.08);
}
.sim-preview {
  width: 100%;
  height: 140px;
  background: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
}
.sim-preview canvas { display: block; width: 100%; height: 100%; }
.sim-info {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sim-info h2 { font-size: 1.05rem; font-weight: 700; }
.sim-info p { color: var(--muted); font-size: .88rem; line-height: 1.65; flex: 1; }
.sim-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .5rem;
  background: rgba(17,24,39,.08);
  border: 1px solid rgba(17,24,39,.18);
  color: var(--accent);
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  transition: all .15s;
  align-self: flex-start;
}
.sim-btn:hover {
  background: rgba(17,24,39,.12);
  border-color: var(--accent);
  text-decoration: none;
}

/* ── BACK LINK / HEADER AREA ── */
.back-link {
  color: var(--muted);
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.subtitle { color: var(--muted); font-size: .95rem; }

/* ── FOOTER ── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem;
  font-size: .82rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── HERO HEADER (simulations.html) ── */
.hero-header {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
}
.hero-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; letter-spacing: -.02em; }
.hero-header h1 em { color: var(--accent); font-style: normal; }
.hero-header p { color: var(--muted); font-size: .95rem; margin-bottom: 1.5rem; }
.hero-tags { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.tag {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
  font-family: 'Courier New', monospace;
  padding: .25rem .75rem;
  border-radius: 20px;
}

/* ── MISC ── */
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; color: var(--text); }
.info-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.info-list li { color: var(--muted); font-size: .88rem; display: flex; gap: .5rem; }
.info-list li::before { content: '//'; color: var(--accent); font-family: 'Courier New', monospace; flex-shrink: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .header { padding: 0 1rem; gap: .75rem; }
  .page-wrap { padding: 1rem; }
  .panel { padding: 1rem; }
  .ctrl-grid { grid-template-columns: 1fr; }
  .sim-gallery { grid-template-columns: 1fr; }
  .hero-header { padding: 1.5rem 1rem; }
  .breadcrumb { display: none; }
}

/* ===== i18n language switcher ===== */
.lang-switcher{display:flex;align-items:center;gap:.25rem;margin-left:auto;background:rgba(0,0,0,.05);border-radius:6px;padding:2px}
.lang-btn{padding:.3rem .7rem;font-size:.78rem;font-weight:600;color:#6b7280;background:transparent;border:none;border-radius:4px;cursor:pointer;font-family:inherit;transition:all .15s ease}
.lang-btn:hover{color:#111827}
.lang-btn.active{background:#fff;color:#111;box-shadow:0 1px 3px rgba(0,0,0,.12)}
.header .lang-switcher{margin-left:0;margin-right:0}
@media(max-width:640px){.lang-switcher{position:absolute;top:1rem;right:1rem}}
