:root {
  --ink: #08284f;
  --blue: #1597e8;
  --blue-2: #67d8ff;
  --green: #19c99a;
  --red: #ff5b6e;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(21, 151, 232, 0.2);
  --shadow: 0 24px 70px rgba(10, 85, 150, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Tajawal", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(103, 216, 255, 0.45), transparent 28%),
    radial-gradient(circle at 78% 82%, rgba(25, 201, 154, 0.16), transparent 26%),
    linear-gradient(135deg, #effbff 0%, #ffffff 46%, #dff6ff 100%);
}

button {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  width: min(1500px, 100%);
  min-height: 100vh;
  padding: 18px;
}

.stage {
  position: relative;
  min-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.06)),
    #eafdff;
  box-shadow: var(--shadow);
}

#scannerCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero {
  position: absolute;
  top: 24px;
  right: 24px;
  left: 24px;
  z-index: 2;
  max-width: 820px;
  pointer-events: none;
}

.hero span,
.panel-title span {
  display: block;
  margin-bottom: 6px;
  color: #116eb4;
  font-weight: 900;
  font-size: 0.9rem;
}

.hero h1 {
  margin: 0;
  color: #06244b;
  font-size: clamp(2rem, 4.5vw, 5.4rem);
  line-height: 0.95;
}

.hero p {
  max-width: 650px;
  margin: 12px 0 0;
  color: #315f88;
  font-size: clamp(0.95rem, 1.2vw, 1.2rem);
  line-height: 1.65;
}

.live-strip {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  pointer-events: none;
}

.live-strip div,
.control-panel,
.explain-card,
.alert-card,
.mini-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(10, 85, 150, 0.12);
  backdrop-filter: blur(16px);
}

.live-strip div {
  min-height: 74px;
  padding: 13px 15px;
}

.live-strip span {
  display: block;
  color: #4b7699;
  font-size: 0.86rem;
}

.live-strip strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 1.45rem;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 36px);
  padding: 20px;
  overflow-y: auto;
}

.panel-title h2,
.explain-card h3 {
  margin: 0;
  line-height: 1.08;
}

.panel-title h2 {
  font-size: 1.95rem;
}

.panel-title p {
  margin: 12px 0 0;
  color: #315f88;
  font-size: 1rem;
  line-height: 1.75;
}

.buttons {
  display: grid;
  gap: 8px;
}

.part-btn {
  min-height: 46px;
  padding: 10px 13px;
  cursor: pointer;
  color: var(--ink);
  text-align: right;
  font-weight: 800;
  border: 1px solid rgba(21, 151, 232, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.part-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 151, 232, 0.55);
  background: #fff;
}

.part-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #116eb4, #20b7ff);
  box-shadow: 0 16px 32px rgba(32, 183, 255, 0.26);
}

.explain-card,
.icon-grid,
.alert-card {
  padding: 16px;
}

.explain-card h3 {
  margin-bottom: 10px;
  font-size: 1.12rem;
}

.explain-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0 20px 0 0;
  color: #315f88;
  line-height: 1.6;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.icon-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 9px;
  align-items: center;
  min-height: 62px;
  padding: 9px;
  cursor: pointer;
  text-align: right;
  color: var(--ink);
  border: 1px solid rgba(21, 151, 232, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-card:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 151, 232, 0.5);
  background: #fff;
}

.icon-card.active {
  border-color: rgba(21, 151, 232, 0.72);
  background: rgba(224, 247, 255, 0.95);
}

.icon-shape {
  grid-row: 1 / 3;
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), transparent 42%),
    linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 8px 18px rgba(21, 151, 232, 0.22);
}

.icon-card strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.icon-card small {
  color: #47749d;
  font-size: 0.75rem;
}

.alert-card {
  background: rgba(255, 255, 255, 0.78);
}

.alert-card div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(255, 91, 110, 0.12);
}

.alert-card p {
  margin: 10px 0 0;
  color: #315f88;
  line-height: 1.6;
}

.mini-chart {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 155px;
  margin-top: auto;
  padding: 14px;
}

.mini-chart div {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
  height: 125px;
  text-align: center;
  color: #47749d;
  font-size: 0.82rem;
  font-style: normal;
}

.mini-chart span {
  display: block;
  width: 100%;
  height: var(--h);
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--blue-2), var(--blue));
}

.mini-chart em {
  font-style: normal;
  font-weight: 800;
}

@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 65vh;
  }

  .control-panel {
    min-height: auto;
  }
}

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

  .hero {
    top: 14px;
    right: 14px;
    left: 14px;
  }

  .live-strip {
    right: 12px;
    bottom: 12px;
    left: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-strip div {
    min-height: 62px;
    padding: 10px;
  }

  .live-strip strong {
    font-size: 1.1rem;
  }
}
