:root {
      --bg: #f6f2e7;
      --panel: #fffaf0;
      --ink: #3c2b1d;
      --accent: #7a4f2a;
      --head: #1f4fd6;
      --tail: #d97706;
      --shell: #7b5b37;
      --shell2: #d3b585;
      --ok: #1f7a1f;
      --mut: #e11d48;
      --line-color: #3c2b1d;
    }
    .iching-app-container {
      margin: 0 auto;
      padding: 18px 16px 28px;
    }
    h1 {
      margin: 0 0 8px;
      font-size: 24px;
      text-align: center;
    }
    .hint {
      text-align: center;
      font-size: 14px;
      opacity: 0.88;
      margin-bottom: 14px;
      line-height: 1.5;
    }
    #canvas-container {
      display: flex;
      justify-content: center;
      /* ป้องกันเผลอเลื่อนจอตอนถู */
      touch-action: none;
    }
    canvas {
      width: min(92vw, 600px);
      height: min(92vw, 600px);
      border-radius: 20px;
      box-shadow: 0 10px 32px rgba(60, 43, 29, 0.12);
      touch-action: none;
      background: radial-gradient(circle at 50% 45%, #fffdf7, #f0e8d7 72%, #eadfc7 100%);
    }
    .controls {
      display: flex;
      gap: 10px;
      justify-content: center;
      align-items: center;
      flex-wrap: wrap;
      //margin: 14px 0;
    }
    button {
      border: 0;
      border-radius: 999px;
      padding: 11px 18px;
      font-size: 15px;
      cursor: pointer;
      background: var(--accent);
      color: white;
      box-shadow: 0 4px 14px rgba(122,79,42,0.2);
    }
    .secondary {
      background: #8a8a8a;
    }
    .badge {
      border: 0;
      border-radius: 999px;
      padding: 11px 18px;
      font-size: 15px;
      font-weight: bold;
      background: var(--ok);
      color: white;
      box-shadow: 0 4px 14px rgba(31,122,31,0.2);
      user-select: none;
    }
    .grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin-top: 8px;
    }
    .card {
      background: #f9f7f5;
      border: 1px solid #e9dcc1;
      border-radius: 16px;
      padding: 12px 14px;
      box-shadow: 0 6px 18px rgba(60,43,29,0.06);
    }
    .status {
      text-align: center;
      font-size: 15px;
      line-height: 1.6;
    }
    .legend {
      display: flex;
      justify-content: center;
      gap: 16px;
      flex-wrap: wrap;
      font-size: 13px;
      margin-top: 8px;
    }
    .dot {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      margin-right: 6px;
      vertical-align: middle;
    }
    #gua_result {
      font-family: "Noto Sans Thai", system-ui, sans-serif;
      line-height: 1.8;
      text-align: center;
      font-size: 18px;
    }
    .small {
      font-size: 13px;
      opacity: 0.82;
    }
    .gua-line-container {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      margin-bottom: 6px;
    }
    .gua-line-label {
      width: 20px;
      font-size: 14px;
      color: #666;
      text-align: right;
    }
    .gua-line-wrapper {
      position: relative;
      width: 120px;
      height: 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .gua-bar {
      height: 100%;
      background-color: var(--line-color);
      border-radius: 2px;
    }
    .gua-bar.yang {
      width: 100%;
    }
    .gua-bar.yin {
      width: 44%; 
    }
    .gua-symbol {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      font-weight: bold;
      color: var(--mut);
    }
    .gua-info {
      width: 140px;
      font-size: 13px;
      text-align: left;
    }
    .mut-badge {
      display: inline-block;
      background: var(--mut);
      color: white;
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 4px;
      margin-left: 6px;
      vertical-align: middle;
    }
    .hexagram-result {
      margin-top: 20px;
      padding-top: 16px;
      border-top: 2px dashed #e9dcc1;
      text-align: left;
    }
    .hexagram-card {
      background: #fff;
      border: 1px solid #e9dcc1;
      border-radius: 10px;
      padding: 14px;
      margin-bottom: 12px;
    }
    .hexagram-card.mutated {
      background: #fffdf7;
      border-color: #fca5a5;
    }
    .hexagram-title {
      font-weight: bold;
      font-size: 16px;
      margin-bottom: 4px;
    }