html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.6)),
    url("/static/images/real-flat-earth-representation-v2.jpg") no-repeat center center fixed;
  background-size: cover;
  font-family: Arial, sans-serif;
  color: #fff;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  min-height: 100vh;
}

.header-flex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 1.2rem auto 0.3rem;
  padding: 0 1rem;
}

.header-flex img {
  height: 46px;
  vertical-align: middle;
}

.header-flex h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  letter-spacing: 0.02em;
  text-align: left;
  text-shadow: 0 0 10px #000b;
}

.x-link {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.x-link img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #000;
  box-shadow: 0 1px 5px #0008;
}

.x-link span {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

canvas {
  touch-action: none;
}

.container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  width: min(100%, 1800px);
  margin: 30px auto 0;
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(270px, 100%);
  padding: 18px 16px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 0 9px #0006;
  color: #fff;
  font-size: 14px;
  text-align: center;
  position: sticky;
  top: 16px;
  height: fit-content;
  backdrop-filter: blur(6px);
}

.panel label,
.panel select,
.panel input {
  color: #fff;
}

.panel label {
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 700;
}

.panel input[type="number"],
.panel select {
  width: 132px;
  padding: 4px 8px;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.panel button,
.graph-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 18px;
  border: none;
  border-radius: 7px;
  background: #111;
  color: #fff;
  box-shadow: 0 0 7px #0007;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
}

.panel button:hover,
.graph-actions button:hover {
  background: #333;
}

.field-note {
  width: 100%;
  margin: -6px 0 0;
  color: #d2d2d2;
  font-size: 12px;
}

.promo-card {
  width: 100%;
  margin-top: 12px;
}

.promo-card a {
  display: block;
  color: #fffa;
  text-decoration: none;
}

.promo-card img {
  width: 100%;
  max-width: 180px;
  border-radius: 9px;
  box-shadow: 0 2px 8px #0007;
}

.promo-card span {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
}

.sim-area {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-width: 320px;
  min-height: 320px;
  position: relative;
}

#sim-canvas {
  display: block;
  width: 100%;
  max-width: min(90vw, 1100px);
  height: auto;
  aspect-ratio: 1 / 1;
  background: #101018;
  border-radius: 50%;
  box-shadow: 0 0 24px #000b;
}

#magnifier-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  border: 2px solid #888;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

.about-section {
  max-width: 900px;
  margin: 60px auto 32px;
  padding: 14px 26px 24px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.about-section h2 {
  margin: 0 0 20px;
  padding: 0;
  font-size: 2em;
  letter-spacing: 0.02em;
  text-shadow: 0 0 10px #000b;
}

.about-text {
  margin: 0 auto;
  color: #eee;
  font-size: 14px;
  line-height: 1.8;
}

.footerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  margin-top: 28px;
  padding: 0 32px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 14px;
}

.footerbar img {
  height: 38px;
  vertical-align: middle;
}

.footerbar a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footerbar a:hover {
  color: #ff0;
  text-decoration: underline;
}

.footer-center {
  flex: 1;
  text-align: center;
}

.footer-right {
  min-width: 120px;
  text-align: right;
}

.graph-popup {
  position: fixed;
  top: 80px;
  left: 80px;
  z-index: 30;
  padding: 24px 18px 18px;
  border-radius: 12px;
  background: #222;
  box-shadow: 0 0 20px #000a;
}

.graph-popup[hidden] {
  display: none;
}

.graph-header {
  margin-bottom: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: move;
}

.graph-close {
  float: right;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
}

#graph-canvas {
  background: #111;
  border-radius: 10px;
  margin-bottom: 10px;
}

.graph-actions {
  display: flex;
  gap: 20px;
}

@media (max-width: 1100px) {
  .container {
    gap: 16px;
  }

  .footerbar {
    padding: 0 20px;
  }
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
    align-items: center;
  }

  .panel {
    position: static;
    width: min(520px, 92vw);
  }

  .sim-area {
    width: 100%;
  }

  #sim-canvas {
    width: min(92vw, 900px);
  }

  .about-section {
    margin: 40px 16px 24px;
  }
}

@media (max-width: 640px) {
  .header-flex {
    flex-direction: column;
    gap: 10px;
  }

  .header-flex h1 {
    text-align: center;
  }

  .panel {
    width: 92vw;
  }

  .footerbar {
    flex-direction: column;
    justify-content: center;
    padding: 12px;
    text-align: center;
  }

  .footer-center,
  .footer-right {
    text-align: center;
  }

  .graph-popup {
    top: 20px;
    left: 12px;
    width: calc(100vw - 24px);
    padding: 18px 12px 12px;
  }

  #graph-canvas {
    width: 100%;
    height: auto;
  }

  .graph-actions {
    flex-wrap: wrap;
    gap: 12px;
  }
}
