:root {
      --main-red: #d7191d;
      --bg: #f4f4f4;
      --panel: #ffffff;
      --text: #222;
      --sub: #666;
      --line: #e5e5e5;
      --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
      --radius: 12px;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      padding: 20px;
      font-family: sans-serif;
      background: var(--bg);
      color: var(--text);
    }

    .container {
      max-width: 1180px;
      margin: 0 auto;
      display: flex;
      gap: 20px;
      align-items: stretch;
    }

    .input-panel,
    .result-panel {
      background: var(--panel);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }

    .input-panel {
      width: 340px;
      padding: 24px;
    }

    .result-panel {
      flex: 1;
      padding: 24px;
    }

    .section-title {
      margin: 0 0 20px;
      padding-left: 10px;
      border-left: 4px solid var(--main-red);
      font-size: 1.2rem;
      font-weight: 700;
    }

    .result-title {
      margin: 0 0 22px;
      text-align: center;
      font-size: 1.9rem;
      font-weight: 700;
    }

    .input-group {
      margin-bottom: 18px;
    }

    .input-group label {
      display: block;
      margin-bottom: 8px;
      font-weight: 700;
    }

    .input-group input,
    .input-group select {
      width: 100%;
      padding: 14px 12px;
      border: 1px solid #ccc;
      border-radius: 8px;
      font-size: 1rem;
      background: #fff;
    }

    .field-hint {
      margin-top: 6px;
      color: var(--sub);
      font-size: 0.86rem;
    }

    .field-error {
      display: none;
      margin-top: 6px;
      color: #c81f1f;
      font-size: 0.86rem;
    }

    .field-error.show {
      display: block;
    }

    .error {
      border-color: #c81f1f !important;
      background: #fff8f8;
    }

    button {
      width: 100%;
      margin-top: 8px;
      padding: 18px;
      border: none;
      border-radius: 8px;
      background: #00888d;
      color: #fff;
      font-size: 1.05rem;
      font-weight: 700;
      cursor: pointer;
    }

    button:hover { opacity: 0.95; }

    .result-body {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 190px;
      gap: 22px;
      align-items: start;
    }

    .figure-board {
      min-height: 520px;
      border: 1px solid #ddd;
      border-radius: 12px;
      background: linear-gradient(180deg, #f7f7f7 0%, #efefef 100%);
      overflow: hidden;
      display: flex;
      align-items: end;
      justify-content: center;
      padding: 16px;
    }

    .figure-board img {
      max-width: 100%;
      max-height: 480px;
      display: none;
      object-fit: contain;
    }

    .img-fallback {
      display: none;
      color: #666;
      text-align: center;
      font-size: 0.95rem;
      line-height: 1.6;
    }

    .result-card {
      border: 2px solid var(--main-red);
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.95);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
      padding: 14px;
      text-align: center;
    }

    .result-item + .result-item {
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid var(--line);
    }

    .result-label {
      font-size: 0.92rem;
      color: var(--sub);
      margin-bottom: 4px;
      line-height: 1.35;
    }

    .result-value {
      font-weight: 800;
      color: var(--main-red);
      line-height: 1.15;
    }

    .result-value.sai { font-size: 2.1rem; }
    .result-value.normal { font-size: 1.05rem; }

    .figure-caption {
      margin-top: 14px;
      text-align: center;
      color: var(--sub);
      font-size: 0.92rem;
    }

    .meta-row {
      display: flex;
      justify-content: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .meta-chip {
      padding: 6px 12px;
      border-radius: 999px;
      border: 1px solid #e8e8e8;
      background: #fafafa;
      color: #555;
      font-size: 0.92rem;
    }

    .note-box {
      margin-top: 16px;
      padding: 12px 14px;
      border-radius: 10px;
      background: #fff7f7;
      border: 1px solid #f0d0d0;
      color: #555;
      font-size: 0.9rem;
      line-height: 1.6;
    }

    @media (max-width: 980px) {
      .container { flex-direction: column; }
      .input-panel { width: 100%; }
      .result-body { grid-template-columns: 1fr; }
      .figure-board { min-height: 420px; }
      .result-card { max-width: 360px; margin: 0 auto; }
    }