/* Gravitációs szimuláció — reszponzív kezelőfelület, külső könyvtárak nélkül. */
:root {
  color-scheme: dark;
  --bg: #090c12;
  --surface: #111723;
  --surface-2: #151e2d;
  --surface-3: #1b2535;
  --text: #ecf2fc;
  --muted: #99a9bf;
  --subtle: #77879d;
  --line: rgba(168, 191, 222, .19);
  --line-strong: rgba(184, 205, 231, .32);
  --accent: #9fd6ff;
  --accent-strong: #68bbff;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 55% at 0% -15%, rgba(35, 86, 149, .23), transparent 80%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(57, 64, 121, .15), transparent 78%),
    var(--bg);
}
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="range"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}
button:disabled { opacity: .5; cursor: not-allowed; }

.lathatatlan { display: none; }

.app-shell { max-width: 1620px; margin: 0 auto; padding: clamp(20px, 3vw, 48px); }
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 30px; }
.eyebrow { color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .22em; margin: 0 0 12px; }
h1 { font-size: clamp(2.25rem, 4.2vw, 4.3rem); letter-spacing: -.055em; line-height: 1.04; margin: 0; font-weight: 760; }
h1 span { color: var(--accent); }
.lead { margin: 14px 0 0; font-size: .95rem; line-height: 1.5; color: var(--muted); }
.header-tag { display: flex; align-items: center; gap: 9px; flex-shrink: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .12em; }
.tag-dot { width: 7px; height: 7px; border-radius: 50%; background: #87ceac; box-shadow: 0 0 10px rgba(135, 206, 172, .65); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
.visual-section, .control-section { min-width: 0; display: flex; flex-direction: column; }
.section-heading { min-height: 42px; margin: 0 4px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: .01em; }
.section-caption { color: var(--subtle); font-size: .76rem; white-space: nowrap; }
.visual-card, .controls-card { border: 1px solid var(--line-strong); background: rgba(17, 23, 35, .94); border-radius: 28px; box-shadow: var(--shadow); }

/* SVG terület */
.visual-card { position: relative; display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 620px; }
.visual-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 21px 22px 0; position: relative; z-index: 1; }
.status { display: inline-flex; align-items: center; gap: 9px; color: #c4e3d5; font-size: .8rem; font-weight: 700; }
.status-light { width: 9px; height: 9px; border-radius: 50%; background: #6bc8a2; box-shadow: 0 0 0 5px rgba(107, 200, 162, .10); }
.time-display { font: 500 .86rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.simulation-svg { display: block; width: 100%; flex: 1; min-height: 0; max-height: 820px; overflow: visible; }
.planet-label { fill: #aebcd1; font: 14px "Segoe UI", sans-serif; }
.visual-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 15px 22px 20px; color: var(--subtle); font-size: .75rem; }
.small-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; vertical-align: 2px; background: #86bbf7; border-radius: 50%; }

/* Kezelőpanel */
.controls-card { padding: clamp(16px, 2vw, 24px); }
.playback-bar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 19px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 11px; padding: 11px 15px; min-height: 44px; font-size: .86rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; transition: background .15s, transform .15s, border-color .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: #a0d6ff; color: #0c1828; border-color: #a0d6ff; }
.btn-primary:hover { background: #c5e8ff; }
.btn-secondary { background: #202b3e; color: #e2ebfa; border-color: var(--line-strong); }
.btn-secondary:hover { background: #2a394f; border-color: rgba(186, 210, 238, .5); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.inner-panel { min-width: 0; border: 1px solid var(--line); border-radius: 19px; padding: 17px 15px; background: var(--surface-2); display: flex; flex-direction: column; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-title-row h3 { margin: 0; font-size: 1.06rem; letter-spacing: -.025em; }
.panel-counter { color: var(--subtle); font: 600 .7rem ui-monospace, Consolas, monospace; letter-spacing: .03em; }
.planet-data { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.planet-data > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(163, 185, 216, .11); }
.planet-data dt { color: var(--muted); font-size: .78rem; }
.planet-data dd { margin: 0; color: var(--text); font-weight: 650; font-size: .83rem; font-variant-numeric: tabular-nums; }
.color-data { display: flex; align-items: center; gap: 7px; }
.color-data code { font: inherit; }
.color-swatch { width: 13px; height: 13px; background: var(--swatch); display: inline-block; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; }
.panel-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 18px; }
.btn-small { flex: 1; min-width: 0; min-height: 40px; padding: 9px 8px; font-size: .76rem; }

/* Form */
.new-body-form { display: flex; flex-direction: column; gap: 11px; }
.field-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 7px; }
.field-row label, .vector-group legend { color: var(--muted); font-size: .77rem; }
input[type="text"], input[type="number"], select {
  min-width: 0; width: 100%; color: var(--text); background: #0d1420; border: 1px solid var(--line-strong); border-radius: 8px; height: 36px; padding: 6px 10px; font-size: .84rem;
}
input::placeholder { color: #5e718a; }
input[type="color"] { width: 100%; height: 36px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0d1420; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.vector-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.vector-group legend { margin-bottom: 6px; padding: 0; }
.vector-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.vector-inputs label { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--subtle); font-size: .72rem; }
.vector-inputs input { width: 100%; min-width: 0; }
.btn-full { width: 100%; margin-top: 3px; }

/* Haladó beállítások és mentett rendszerek */
.settings-panel { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 17px 2px; border-bottom: 1px solid var(--line); }
.speed-setting { flex: 1; min-width: 110px; }
.setting-heading { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: .79rem; }
.setting-heading output { font: 600 .78rem ui-monospace, Consolas, monospace; color: var(--text); }
input[type="range"] { width: 100%; margin: 0; height: 5px; accent-color: var(--accent-strong); }
.switch-setting { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-size: .8rem; color: var(--muted); cursor: pointer; }
.switch-setting input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 39px; height: 22px; border-radius: 99px; border: 1px solid var(--line-strong); background: #313d4e; position: relative; transition: background .2s; }
.switch::before { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; top: 3px; left: 3px; background: white; transition: transform .2s; }
.switch-setting input:checked + .switch { background: #6aafe4; }
.switch-setting input:checked + .switch::before { transform: translateX(17px); }
.switch-setting input:focus-visible + .switch { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.preset-bar { display: flex; align-items: end; gap: 10px; padding-top: 17px; }
.preset-select-wrap { flex: 1; min-width: 0; }
.preset-select-wrap label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .76rem; }
.preset-bar select { min-height: 44px; }
.preset-bar .btn { min-height: 44px; }
.app-footer { display: flex; justify-content: space-between; gap: 24px; margin: 22px 3px 0; font-size: .71rem; line-height: 1.5; color: var(--subtle); }
.app-footer p { margin: 0; }

@media (max-width: 1240px) {
  .workspace { grid-template-columns: 1fr; }
  .visual-card { min-height: 560px; }
  .simulation-svg { max-height: 650px; }
  .panel-grid { gap: 16px; }
  .inner-panel { padding: 20px; }
  .field-row { grid-template-columns: 94px minmax(0, 1fr); }
}
@media (max-width: 660px) {
  .app-shell { padding: 19px 13px 28px; }
  .app-header { margin-bottom: 22px; }
  .header-tag, .section-caption { display: none; }
  .lead { font-size: .85rem; }
  .workspace { gap: 22px; }
  .visual-card, .controls-card { border-radius: 19px; }
  .visual-card { min-height: 400px; }
  .visual-topbar { padding: 17px 16px 0; }
  .visual-footer { padding: 10px 16px 17px; }
  .panel-grid { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: 95px minmax(0, 1fr); }
  .playback-bar .btn { flex: 1; padding: 10px 7px; font-size: .77rem; }
  .app-footer { flex-direction: column; gap: 6px; }
}
@media (max-width: 405px) {
  .settings-panel { align-items: stretch; flex-direction: column; gap: 15px; }
  .playback-bar .btn:last-child { flex-basis: 100%; }
  .preset-bar { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
