:root {
  --bg-main: #040b1f;
  --bg-accent: #130a2d;
  --panel: rgba(13, 20, 43, 0.86);
  --panel-strong: #101d3d;
  --text-main: #edf4ff;
  --text-soft: #acb8d9;
  --line: rgba(111, 148, 255, 0.42);
  --blue: #3c84ff;
  --blue-strong: #19b8ff;
  --cyan: #34e8ff;
  --magenta: #d54cff;
  --gold: #ffd166;
  --red: #ff708f;
  --green: #8fffb7;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Franklin Gothic Medium", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 14% 10%, rgba(39, 120, 255, 0.28), transparent 36%),
    radial-gradient(circle at 84% 22%, rgba(213, 76, 255, 0.26), transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(52, 232, 255, 0.14), transparent 38%),
    linear-gradient(150deg, var(--bg-main), var(--bg-accent) 72%);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(rgba(91, 145, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 145, 255, 0.08) 1px, transparent 1px);
  background-size: 3px 3px, 34px 34px, 34px 34px;
  opacity: 0.45;
  mix-blend-mode: screen;
}

.app-shell {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 20px 38px;
}

.view.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.glass-panel {
  position: relative;
  background: linear-gradient(
    155deg,
    rgba(9, 16, 35, 0.94),
    rgba(19, 16, 46, 0.9) 58%,
    rgba(18, 30, 57, 0.9)
  );
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.glass-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(160, 188, 255, 0.18), inset 0 0 26px rgba(51, 130, 255, 0.14);
}

.glass-panel:hover {
  transform: translateY(-1px);
  border-color: rgba(127, 171, 255, 0.65);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.5), 0 0 22px rgba(53, 214, 255, 0.28),
    0 0 28px rgba(213, 76, 255, 0.2);
}

.glass-panel.narrow {
  max-width: 460px;
  margin: 7vh auto 0;
}

.market-panel {
  max-width: 860px;
  margin: 7vh auto 0;
  text-align: center;
}

.market-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.market-btn {
  min-height: 92px;
  font-size: 1.3rem;
  letter-spacing: 0.4px;
}

.market-btn.active {
  outline: 2px solid rgba(255, 226, 115, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 226, 115, 0.14), 0 10px 24px rgba(33, 192, 255, 0.34);
}

.market-badge,
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(132, 171, 255, 0.38);
  background: rgba(55, 88, 173, 0.18);
  color: #dfe9ff;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 12px;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.65rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  color: #dae6ff;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--text-soft);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-large {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #d6def0;
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 1px solid rgba(98, 140, 240, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-main);
  background: linear-gradient(140deg, rgba(7, 14, 32, 0.95), rgba(22, 16, 42, 0.75));
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(52, 232, 255, 0.24), 0 0 16px rgba(52, 232, 255, 0.2);
}

button {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(120deg, #1968ff, #21c0ff);
  color: #fff;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 7px 20px rgba(27, 118, 255, 0.38);
}

button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(33, 192, 255, 0.34), 0 0 16px rgba(25, 184, 255, 0.3);
}

button.ghost {
  border: 1px solid rgba(132, 171, 255, 0.45);
  background: linear-gradient(145deg, rgba(24, 31, 63, 0.86), rgba(17, 20, 43, 0.86));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.help-line {
  margin-top: 14px;
  color: var(--text-soft);
}

.error {
  min-height: 20px;
  color: #ff8da0;
}

.ok {
  min-height: 20px;
  color: var(--green);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

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

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.team-card {
  background: linear-gradient(155deg, rgba(14, 23, 45, 0.88), rgba(18, 15, 37, 0.78));
  border: 1px solid rgba(108, 141, 219, 0.34);
  border-radius: 12px;
  padding: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  padding: 6px 10px;
  background: rgba(79, 123, 214, 0.2);
  border: 1px solid rgba(100, 144, 231, 0.35);
  border-radius: 999px;
}

.chips button {
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(41, 72, 154, 0.9), rgba(90, 43, 173, 0.9));
  border: 1px solid rgba(149, 175, 255, 0.5);
}

.row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.result-box {
  border: 1px solid rgba(119, 159, 255, 0.42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(14, 22, 43, 0.94), rgba(26, 19, 48, 0.88));
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  box-shadow: inset 0 0 24px rgba(62, 123, 255, 0.1);
}

.result-box.wide {
  margin-top: 14px;
}

.result-box strong {
  font-size: 1.42rem;
  color: var(--green);
  text-shadow: 0 0 10px rgba(143, 255, 183, 0.25);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.92rem;
}

thead th {
  color: #ebf2ff;
  background: linear-gradient(120deg, rgba(36, 79, 176, 0.24), rgba(105, 52, 184, 0.2));
}

th,
td {
  border-bottom: 1px solid rgba(126, 152, 209, 0.28);
  padding: 9px;
  text-align: left;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(52, 232, 255, 0.1), rgba(213, 76, 255, 0.08));
}

tfoot td {
  font-weight: 700;
  color: #d8e6ff;
}

canvas {
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(116, 142, 198, 0.4);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(8, 13, 30, 0.95), rgba(16, 25, 51, 0.9));
  box-shadow: inset 0 0 18px rgba(60, 132, 255, 0.12);
}

.chart-grid {
  display: grid;
  gap: 14px;
}

.simulation-charts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#final-sale-price {
  text-align: center;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--green);
  border: 1px solid rgba(157, 255, 193, 0.45);
  background: linear-gradient(145deg, rgba(10, 26, 36, 0.94), rgba(18, 22, 45, 0.9));
  box-shadow: inset 0 0 18px rgba(143, 255, 183, 0.16), 0 0 14px rgba(52, 232, 255, 0.14);
}

#submit-team-btn {
  min-width: 230px;
}

#team-message {
  font-size: 1.1rem;
  color: #72ffb1;
}

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

  .simulation-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 12px 26px;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.35rem;
  }

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

  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .market-selector {
    grid-template-columns: 1fr;
  }

  #final-sale-price {
    font-size: 1.9rem;
  }
}
