:root {
  --page-bg: #17120d;
  --board-wood-light: #6a4328;
  --board-wood-dark: #2a1710;
  --board-edge: #160b07;
  --board-shadow: rgba(0, 0, 0, 0.4);
  --brass: #c8a15b;
  --brass-dark: #88693a;
  --display-frame: #1f221d;
  --display-panel: #10150f;
  --segment-off: rgba(65, 26, 16, 0.25);
  --segment-on: #ff6f47;
  --segment-glow: rgba(255, 103, 64, 0.55);
  --green-on: #53ff92;
  --green-off: rgba(46, 97, 61, 0.3);
  --red-on: #ff4d4d;
  --red-off: rgba(97, 41, 41, 0.32);
  --switch-on: #d9ceb8;
  --switch-off: #6e6459;
  --switch-base: #24211d;
  --text-main: #f5ecdf;
  --text-muted: rgba(245, 236, 223, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(255, 219, 176, 0.08), transparent 35%),
    linear-gradient(180deg, #241812 0%, #130d0a 100%);
  color: var(--text-main);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.board {
  width: min(1400px, 100%);
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 226, 179, 0.06), transparent 24%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 3px,
      transparent 3px,
      transparent 32px
    ),
    linear-gradient(180deg, var(--board-wood-light), #4b2f1e 24%, #3b2417 55%, var(--board-wood-dark));
  border: 10px solid var(--board-edge);
  box-shadow:
    0 28px 60px var(--board-shadow),
    inset 0 2px 0 rgba(255, 233, 199, 0.15),
    inset 0 -10px 24px rgba(0, 0, 0, 0.28);
}

.board-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--brass);
}

.board-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(460px, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.ip-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  padding: 10px 14px;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(200, 161, 91, 0.35);
  background: rgba(10, 8, 7, 0.35);
  backdrop-filter: blur(6px);
  justify-self: center;
}

.ip-readout__label {
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.ip-readout__value {
  font-family: "Courier New", monospace;
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: var(--green-on);
  text-shadow: 0 0 12px rgba(83, 255, 146, 0.25);
}

.ip-readout__input {
  min-width: 140px;
  padding: 7px 12px;
  border: 1px solid rgba(200, 161, 91, 0.28);
  border-radius: 999px;
  background: rgba(8, 14, 9, 0.7);
  color: var(--green-on);
  font-family: "Courier New", monospace;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  text-align: center;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.28);
}

.ip-readout__input:focus {
  outline: 2px solid rgba(83, 255, 146, 0.35);
  outline-offset: 2px;
}

.control-button {
  padding: 8px 14px;
  border: 1px solid rgba(200, 161, 91, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(215, 181, 117, 0.9), rgba(125, 88, 41, 0.95));
  color: #1a120b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    0 8px 14px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 244, 218, 0.55);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.control-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.control-button:active {
  transform: translateY(1px);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 244, 218, 0.45);
}

.control-button:focus-visible {
  outline: 2px solid rgba(255, 231, 189, 0.8);
  outline-offset: 3px;
}

.control-button--cidr {
  min-width: 128px;
}

.cidr-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  height: 100%;
}

.cidr-selector {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(200, 161, 91, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    rgba(8, 9, 8, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 22px rgba(0, 0, 0, 0.14);
}

.cidr-selector.is-disabled {
  opacity: 0.58;
}

.cidr-selector__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.cidr-selector__label {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.cidr-selector__status {
  font-family: "Courier New", monospace;
  font-size: 0.86rem;
  color: var(--brass);
}

.cidr-capacity {
  margin-bottom: 12px;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  color: rgba(245, 236, 223, 0.82);
}

.cidr-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.cidr-option {
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid rgba(200, 161, 91, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-family: "Courier New", monospace;
  font-size: 0.94rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

.cidr-option:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.14);
}

.cidr-option.is-selected {
  background: linear-gradient(180deg, rgba(216, 177, 104, 0.34), rgba(122, 86, 39, 0.28));
  border-color: rgba(216, 177, 104, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 243, 214, 0.16);
}

.cidr-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.cli-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(200, 161, 91, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    #0d120f;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 26px rgba(0, 0, 0, 0.16);
}

.cli-panel__chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
}

.cli-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.cli-dot--red { background: #ff6b6b; }
.cli-dot--amber { background: #ffce58; }
.cli-dot--green { background: #62e38e; }

.cli-panel__title {
  margin-left: 6px;
  font-family: "Courier New", monospace;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cli-output {
  flex: 1;
  margin: 0;
  padding: 12px 16px 14px;
  min-height: 0;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.42;
  color: #8dfbb6;
  white-space: pre-wrap;
  text-shadow: 0 0 10px rgba(83, 255, 146, 0.1);
  overflow-y: auto;
}

.octet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 18px;
}

.octet-panel {
  padding: 18px 14px 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(17, 12, 9, 0.5), rgba(0, 0, 0, 0.16)),
    rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 233, 199, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(0, 0, 0, 0.16);
}

.octet-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding: 0 6px;
}

.octet-title {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.octet-value {
  color: var(--brass);
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
}

.seven-segment-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--display-frame);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.03),
    inset 0 -10px 18px rgba(0, 0, 0, 0.22);
}

.binary-display {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    rgba(8, 12, 9, 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -8px 12px rgba(0, 0, 0, 0.22);
}

.binary-bit {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  color: rgba(245, 236, 223, 0.68);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 120ms ease, background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.binary-bit.is-on {
  color: #09110c;
  background: linear-gradient(180deg, #8dfbb6, #45d97b);
  box-shadow:
    0 0 12px rgba(83, 255, 146, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transform: translateY(-1px);
}

.digit {
  position: relative;
  aspect-ratio: 0.62;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(34, 42, 33, 0.85), var(--display-panel));
}

.segment {
  position: absolute;
  background: var(--segment-off);
  transition: background 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
  opacity: 0.5;
}

.segment.is-on {
  background: var(--segment-on);
  opacity: 1;
  box-shadow: 0 0 12px var(--segment-glow);
}

.segment-a,
.segment-d,
.segment-g {
  left: 18%;
  width: 64%;
  height: 10%;
  clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
}

.segment-a { top: 5%; }
.segment-g { top: 45%; }
.segment-d { bottom: 5%; }

.segment-b,
.segment-c,
.segment-e,
.segment-f {
  width: 12%;
  height: 36%;
  clip-path: polygon(0 10%, 50% 0, 100% 10%, 100% 90%, 50% 100%, 0 90%);
}

.segment-b { right: 10%; top: 10%; }
.segment-c { right: 10%; bottom: 10%; }
.segment-e { left: 10%; bottom: 10%; }
.segment-f { left: 10%; top: 10%; }

.indicator-row,
.switch-row,
.weight-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.indicator {
  width: 18px;
  height: 18px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.28);
  transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.indicator--red {
  background: var(--red-off);
}

.indicator--red.is-on {
  background: var(--red-on);
  box-shadow:
    0 0 10px rgba(255, 77, 77, 0.45),
    inset 0 0 3px rgba(255, 255, 255, 0.55);
}

.toggle {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 72px;
  margin: 0;
  border: 0;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.toggle__lock {
  position: absolute;
  top: -2px;
  left: 50%;
  z-index: 2;
  display: none;
  transform: translateX(-50%);
  font-size: 1rem;
  line-height: 1;
  color: #ffd34d;
  text-shadow: 0 0 10px rgba(255, 211, 77, 0.45);
  pointer-events: none;
}

.toggle.is-locked .toggle__lock {
  display: block;
}

.toggle:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.toggle:focus-visible {
  outline: 2px solid rgba(200, 161, 91, 0.8);
  outline-offset: 4px;
  border-radius: 12px;
}

.toggle::before {
  content: "";
  position: absolute;
  inset: 22px 16px 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, #121110, #2b2722);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -10px 10px rgba(0, 0, 0, 0.28);
}

.toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 22px;
  height: 34px;
  transform: translateX(-50%);
  top: 24px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--switch-off), #4d453e);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 6px 10px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: top 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.toggle.is-on::after {
  top: 10px;
  background: linear-gradient(180deg, #f5ede1, var(--switch-on));
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.weight {
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: rgba(245, 236, 223, 0.82);
}

@media (max-width: 1180px) {
  .control-strip {
    grid-template-columns: 1fr;
  }

  .octet-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 18px 10px;
  }

  .board {
    padding: 18px 12px;
    border-width: 7px;
  }

  .ip-readout {
    border-radius: 16px;
  }

  .ip-readout__input {
    width: 100%;
  }

  .cidr-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cli-output {
    font-size: 0.84rem;
  }

  .octet-grid {
    grid-template-columns: 1fr;
  }

  .indicator-row,
  .binary-display,
  .switch-row,
  .weight-row {
    gap: 4px;
  }

  .toggle::before {
    inset: 22px 8px 6px;
  }
}
