:root {
      --ink: #16202d;
      --sub: #546170;
      --line: rgba(22, 32, 45, 0.12);
      --card: rgba(255, 251, 245, 0.92);
      --card-strong: #fffdfa;
      --accent: #245e9d;
      --accent2: #b25733;
      --shadow: 0 24px 60px rgba(22, 58, 100, 0.12);
      --radius: 24px;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      color: var(--ink);
      font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
      background:
        radial-gradient(circle at top right, rgba(92, 150, 210, 0.18), transparent 24%),
        radial-gradient(circle at left top, rgba(36, 94, 157, 0.12), transparent 20%),
        linear-gradient(180deg, #eef4fb 0%, #e4edf8 100%);
      min-height: 100vh;
    }
    .shell {
      width: min(1400px, calc(100vw - 32px));
      margin: 0 auto;
      padding: 20px 0 32px;
    }

    /* Top bar */
    .topbar {
      display: flex;
      align-items: center;
      padding: 12px 22px;
      border-radius: 999px;
      border: 1px solid rgba(255, 255, 255, 0.6);
      background: rgba(240, 248, 255, 0.85);
      backdrop-filter: blur(10px);
      box-shadow: 0 12px 32px rgba(22, 58, 100, 0.08);
    }
    .topbar a {
      text-decoration: none;
      color: var(--accent);
      font-size: 16px;
      font-weight: 800;
    }

    /* Panel */
    .panel {
      margin-top: 14px;
      padding: 24px 28px;
      border-radius: var(--radius);
      border: 1px solid rgba(255, 255, 255, 0.55);
      background: var(--card);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }

    /* Hero */
    .hero {
      text-align: center;
      padding: 6px 0 18px;
    }
    .hero h1 {
      margin: 0 0 6px;
      font-size: clamp(34px, 4.5vw, 52px);
      letter-spacing: 0.06em;
      color: var(--accent);
    }
    .hero p {
      margin: 0;
      font-size: clamp(16px, 1.8vw, 20px);
      color: var(--sub);
      font-weight: 700;
    }

    /* Controls row */
    .controls-row {
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      align-items: flex-end;
      padding: 20px 0 8px;
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
    }

    .field {
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex: 1 1 140px;
    }
    .field label {
      font-size: 18px;
      font-weight: 900;
      color: var(--ink);
      white-space: nowrap;
    }
    .field label .unit {
      font-size: 14px;
      color: var(--sub);
      font-weight: 700;
      margin-left: 4px;
    }
    .field input[type="number"] {
      width: 100%;
      height: 52px;
      padding: 0 14px;
      border: 1.5px solid var(--line);
      border-radius: 16px;
      background: #f7fbff;
      color: var(--ink);
      font: 800 22px "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    }
    .field input[type="number"]:focus {
      outline: 3px solid rgba(36, 94, 157, 0.18);
      border-color: rgba(36, 94, 157, 0.5);
    }

    /* Trial count selector */
    .trial-selector {
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex: 3 1 360px;
    }
    .trial-selector label {
      font-size: 18px;
      font-weight: 900;
      color: var(--ink);
    }
    .trial-btns {
      display: flex;
      gap: 6px;
      flex-wrap: nowrap;
    }
    .trial-btn {
      height: 52px;
      padding: 0 12px;
      border: 1.5px solid rgba(36, 94, 157, 0.3);
      border-radius: 16px;
      background: #f0f6ff;
      color: var(--accent);
      font-size: 16px;
      font-weight: 900;
      cursor: pointer;
      transition: all 0.15s;
      white-space: nowrap;
    }
    .trial-btn:hover {
      background: #ddeeff;
    }
    .trial-btn.active {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
      box-shadow: 0 8px 20px rgba(36, 94, 157, 0.28);
    }

    /* Bins selector */
    .bins-selector {
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex: 1 1 200px;
    }
    .bins-selector label {
      font-size: 18px;
      font-weight: 900;
      color: var(--ink);
    }
    .bins-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .bins-row input[type="range"] {
      flex: 1;
      accent-color: var(--accent);
      cursor: pointer;
      height: 6px;
    }
    .bins-val {
      min-width: 40px;
      text-align: right;
      font-size: 22px;
      font-weight: 900;
      color: var(--accent);
    }

    /* Run button */
    .run-btn {
      flex: 0 0 auto;
      align-self: flex-end;
      height: 56px;
      padding: 0 36px;
      border: none;
      border-radius: 18px;
      background: linear-gradient(135deg, #245e9d 0%, #3a7fc1 100%);
      color: #fff;
      font-size: 22px;
      font-weight: 900;
      letter-spacing: 0.05em;
      cursor: pointer;
      box-shadow: 0 14px 32px rgba(36, 94, 157, 0.28);
      transition: transform 0.1s, box-shadow 0.1s;
    }
    .run-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 18px 40px rgba(36, 94, 157, 0.36);
    }
    .run-btn:active {
      transform: translateY(0);
    }

    /* Stats bar */
    .stats-bar {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
      margin-top: 20px;
    }
    .stat-box {
      flex: 1 1 140px;
      padding: 14px 18px;
      border-radius: 18px;
      border: 1.5px solid rgba(36, 94, 157, 0.2);
      background: linear-gradient(160deg, #f0f7ff 0%, #e4edf9 100%);
      box-shadow: 0 8px 20px rgba(36, 94, 157, 0.1);
    }
    .stat-box .stat-label {
      font-size: 15px;
      font-weight: 800;
      color: var(--sub);
      margin-bottom: 4px;
    }
    .stat-box .stat-value {
      font-size: 28px;
      font-weight: 900;
      color: var(--accent);
      line-height: 1.1;
    }

    /* Chart area */
    .chart-wrap {
      margin-top: 20px;
      padding: 20px;
      border-radius: 20px;
      border: 1px solid var(--line);
      background: var(--card-strong);
      position: relative;
      min-height: 420px;
    }
    .chart-wrap canvas {
      width: 100% !important;
      display: block;
    }

    /* Insight banner */
    .insight {
      margin-top: 16px;
      padding: 16px 22px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(36, 94, 157, 0.08) 0%, rgba(92, 150, 210, 0.1) 100%);
      border: 1.5px solid rgba(36, 94, 157, 0.2);
      font-size: 20px;
      font-weight: 800;
      color: var(--ink);
      text-align: center;
      line-height: 1.5;
    }
    .insight .highlight {
      color: var(--accent);
    }
    .insight .highlight2 {
      color: var(--accent2);
    }

    /* Empty state */
    .empty-state {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      color: var(--sub);
      pointer-events: none;
    }
    .empty-state .icon {
      font-size: 56px;
      opacity: 0.4;
    }
    .empty-state p {
      font-size: 20px;
      font-weight: 800;
      margin: 0;
      opacity: 0.6;
    }
