/* ============ TOKENS ============ */
:root {
  --bg: #F2ECE0;
  --surface: #FBF7EE;
  --surface-sunken: #EAE2D2;
  --ink: #2B211A;
  --ink-soft: #6B5D4C;
  --ink-faint: #A69A85;
  --line: #D9CFBA;
  --brass: #A6772C;
  --brass-light: #C79A4B;
  --brass-dark: #7A5A20;
  --patina: #4E7B6C;
  --patina-dark: #395E52;
  --rust: #A6432D;

  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ============ HEADER / PLATE ============ */
.plate {
  background: var(--ink);
  color: var(--surface);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--brass);
}

.plate-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-light);
  margin-bottom: 4px;
}

.plate h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.01em;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--ink-faint);
  color: var(--surface);
  padding: 8px 16px;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--brass-light); color: var(--brass-light); }

/* ============ DIVIDERS ============ */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 18px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.divider span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============ GAUGES (sensör okumaları) ============ */
.gauges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.gauge {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 4px;
  padding: 14px 16px;
}

.gauge-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
}
.gauge-value small {
  font-size: 14px;
  color: var(--ink-faint);
  margin-left: 2px;
}

.timestamp {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin: 10px 2px 0;
}

.warning {
  color: var(--rust);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  margin: 8px 2px 0;
}

/* ============ SCENES ============ */
.scenes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.scenes button {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.scenes button:hover {
  border-color: var(--brass);
  color: var(--brass-dark);
}

/* ============ RELAYS - imza öge: pirinç kollu şalter ============ */
.relays {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.relay-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  padding: 12px 14px;
}

.relay-row .name {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  padding: 4px 2px;
  border-bottom: 1px dashed transparent;
}
.relay-row .name:focus {
  outline: none;
  border-bottom: 1px dashed var(--brass);
}

/* Kollu şalter */
.lever {
  position: relative;
  width: 56px;
  height: 30px;
  flex-shrink: 0;
}
.lever input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }

.lever-track {
  position: absolute;
  inset: 0;
  background: var(--ink);
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.lever-track::before {
  content: "OFF";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.lever-track::after {
  content: "ON";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--patina);
  opacity: 0.4;
}

.lever-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: linear-gradient(160deg, var(--brass-light), var(--brass-dark));
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  transition: transform 0.18s ease, background 0.18s ease;
  transform: rotate(-6deg);
}

.lever input:checked ~ .lever-knob {
  transform: translateX(26px) rotate(6deg);
  background: linear-gradient(160deg, #6FA593, var(--patina-dark));
}
.lever input:checked ~ .lever-track::after { opacity: 1; }
.lever input:checked ~ .lever-track::before { opacity: 0.3; }

.lever input:focus-visible ~ .lever-track {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ============ BUTTONS ============ */
.btn-brass {
  margin-top: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 18px;
  background: var(--brass);
  border: none;
  border-radius: 3px;
  color: #fff;
  cursor: pointer;
}
.btn-brass:hover { background: var(--brass-dark); }

/* ============ CAMERA ============ */
.camera-frame {
  background: var(--ink);
  border-radius: 4px;
  border: 3px solid var(--surface-sunken);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.camera-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-placeholder {
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}
.camera-placeholder p { margin: 4px 0; }
.camera-sub { font-size: 11px; opacity: 0.7; }

/* ============ CHARTS ============ */
.charts { display: flex; flex-direction: column; gap: 16px; }
.chart-container {
  height: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
  .gauges { grid-template-columns: 1fr 1fr; }
  .plate h1 { font-size: 21px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .lever-knob { transition: none; }
}
