:root {
    color-scheme: light;
    --bg: #f4eef4; --bg-2: #e9dcc0; --panel: #fffdf8; --panel-2: #faf3e6;
    --ink: #2a2230; --muted: #7a6d7c; --line: #eadfce; --line-strong: #d4bf98;
    --pink: #f3a6c2; --pink-soft: #fde9f1;
    --gold: #b0821f; --gold-hi: #e6bf5c; --plum: #9b3f78; --seal: #b3261e;
    --on: #2563c9; --on-hi: #4d8cf0; --on-soft: #e2ebfb;
    --off: #c4462a; --off-hi: #e8714f; --off-soft: #fbe6dd;
    --tie: #8a7f6c;
    --bar-dark: #2f2c28;
    --sky-1: #a9d4f0; --sky-2: #f5ead2; --m1: #b8d0c6; --m2: #7fa79b; --m3: #4a7568; --mist: #fffaf0;
    --radius: 14px;
    --shadow: 0 2px 0 rgba(90, 64, 20, .08), 0 10px 26px rgba(90, 64, 20, .08);
    --display: "Black Han Sans", "Noto Sans KR", sans-serif;
    --serif: "Gowun Batang", "Noto Serif KR", serif;
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; color: var(--ink); line-height: 1.55;
    font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
    background-color: var(--bg);
    background-image:
      radial-gradient(ellipse 60% 40% at 0% 0%, rgba(243,166,194,.35), transparent 70%),
      radial-gradient(ellipse 50% 40% at 100% 20%, rgba(150,200,240,.35), transparent 70%),
      radial-gradient(ellipse 60% 40% at 100% 100%, rgba(243,166,194,.25), transparent 70%),
      linear-gradient(180deg, #e6f1fb 0%, #f6eef5 35%, #fbf5ec 100%);
    background-attachment: fixed;
  }
  /* 흩날리는 벚꽃잎 */
  .petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
  .petals i { position: absolute; top: -20px; width: 12px; height: 9px; background: linear-gradient(135deg, #ffd3e2, #f39bbd);
    border-radius: 100% 0 100% 0; opacity: .75; animation: fall linear infinite; }
  @keyframes fall { 0% { transform: translate(0, -20px) rotate(0); } 100% { transform: translate(-120px, 105vh) rotate(540deg); } }
  @media (prefers-reduced-motion: reduce) { .petals { display: none; } }
  .topbar, .wrap { position: relative; z-index: 1; }
  .wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }

  /* 상단 바: 게임 창 헤더 느낌 */
  .topbar { background: linear-gradient(180deg, #2b2925, #1b1a17); border-bottom: 3px solid var(--gold); }
  .topbar-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
  .seal-sm { width: 30px; height: 30px; border-radius: 6px; background: var(--seal); color: #fff3d6; display: grid; place-items: center;
    font-family: var(--serif); font-weight: 700; font-size: 16px; transform: rotate(-6deg); flex: none; }
  .topbar-title { font-family: var(--display); color: #f2c54f; font-size: 19px; letter-spacing: .5px; text-shadow: 0 2px 0 #000; }
  .topbar-tag { margin-left: auto; font-size: 12px; color: #d9c9a4; border: 1px solid #5b4c2c; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }

  /* 히어로: 캐릭터 일러스트 배너 */
  .hero { position: relative; margin-top: 18px; border-radius: var(--radius); overflow: hidden; border: 3px solid var(--bar-dark);
    box-shadow: var(--shadow), inset 0 0 0 2px var(--gold); min-height: 340px; display: flex; align-items: center;
    background: #cfe6f7 url("art/hero.jpg") 70% 30% / cover no-repeat; }
  .hero::before { content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(232,244,253,.92) 0%, rgba(232,244,253,.7) 38%, rgba(232,244,253,0) 62%); }
  .hero-text { position: relative; padding: 28px 32px; text-align: left; width: min(560px, 100%); }
  .hex { display: inline-block; font-family: var(--display); font-size: 15px; color: #fff; padding: 5px 22px;
    background: linear-gradient(180deg, #3a3833, #22201c); border: 2px solid var(--gold-hi);
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
  .hero h1 { margin: 10px 0 6px; font-family: var(--display); font-weight: 400; font-size: clamp(34px, 7vw, 56px); line-height: 1.1;
    color: #fff; letter-spacing: 1px; -webkit-text-stroke: 7px #2a1f12; paint-order: stroke fill;
    text-shadow: 0 5px 0 rgba(42,31,18,.55); }
  .hero p { margin: 0; max-width: 420px; font-family: var(--serif); font-weight: 700; font-size: 16px; color: #2a2318;
    text-shadow: 0 1px 0 rgba(255,255,255,.8); }
  @media (max-width: 680px) {
    .hero { display: block; min-height: 0; background: linear-gradient(180deg, #e3f1fc, #f3f8fd); }
    .hero::before { display: none; }
    .hero::after { content: ""; display: block; aspect-ratio: 5 / 4; background: url("art/hero.jpg") 80% 40% / cover no-repeat; }
    .hero-text { text-align: center; padding: 22px 16px 14px; width: 100%; }
    .hero p { margin: 0 auto; }
  }

  /* 온라인 VS 오프라인 캐릭터 + 분석하기 */
  .versus { display: grid; grid-template-columns: 1fr minmax(0, 380px) 1fr; align-items: end; gap: 8px; margin-top: 18px; }
  .versus img { width: 100%; max-width: 200px; height: auto; display: block; filter: drop-shadow(0 8px 10px rgba(60,40,80,.18)); }
  .versus .left { justify-self: end; } .versus .right { justify-self: start; }
  .versus .mid { padding-bottom: 18px; }
  .vs-tag { font-family: var(--display); font-size: 30px; color: var(--plum); text-align: center; letter-spacing: 2px;
    -webkit-text-stroke: 5px #fff; paint-order: stroke fill; margin-bottom: 6px; }
  .vs-tag span:first-child { color: var(--on); } .vs-tag span:last-child { color: var(--off); }
  @media (max-width: 680px) {
    .versus { grid-template-columns: 1fr 1fr; }
    .versus .left, .versus .right { justify-self: center; } .versus img { max-width: 150px; }
    .versus .mid { grid-column: 1 / -1; grid-row: 2; padding-bottom: 0; }
  }
  .verdict > div { position: relative; z-index: 1; }
  .v-char { position: absolute; z-index: 0; right: 8px; bottom: 0; height: 128%; width: auto; pointer-events: none; opacity: .95;
    filter: drop-shadow(0 6px 8px rgba(60,40,80,.15)); }
  .verdict.has-char { padding-right: 180px; min-height: 170px; }
  @media (max-width: 560px) { .v-char { display: none; } .verdict.has-char { padding-right: 22px; } }

  /* 방문(榜文) 두루마리: 문파 홍보 */
  .scroll { position: relative; margin: 22px 10px 0; padding: 18px 22px 18px 92px; background: var(--panel-2);
    border-top: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong); box-shadow: var(--shadow); }
  .scroll::before, .scroll::after { content: ""; position: absolute; top: -8px; bottom: -8px; width: 12px; border-radius: 6px;
    background: linear-gradient(90deg, #5a3a1a, #8b5e2c 45%, #4a2f14); }
  .scroll::before { left: -10px; } .scroll::after { right: -10px; }
  .scroll .seal { position: absolute; left: 20px; top: 50%; translate: 0 -50%; width: 56px; height: 56px; border-radius: 8px;
    background: var(--seal); color: #fff3d6; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.05;
    display: grid; place-items: center; text-align: center; rotate: -7deg; box-shadow: 0 3px 0 rgba(0,0,0,.2);
    border: 2px solid rgba(255,243,214,.5); outline: 2px solid var(--seal); outline-offset: 2px; }
  .scroll h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 18px; }
  .scroll h3 .hl { color: var(--seal); }
  .scroll p { margin: 6px 0 0; font-family: var(--serif); font-size: 14.5px; color: var(--ink); opacity: .85; }
  @media (max-width: 560px) {
    .scroll { padding: 74px 18px 16px; text-align: center; }
    .scroll .seal { left: 50%; top: 14px; translate: -50% 0; }
  }

  /* 공통 카드 / 게임식 소제목 */
  .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
  .tab-title { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 28px 6px 12px;
    background: linear-gradient(180deg, #45423d, #2e2c28); color: #fff; font-size: 15px; font-weight: 700;
    border-left: 5px solid var(--gold-hi); clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%); }
  .tab-title small { font-weight: 400; color: #d8cbb0; font-size: 12px; }

  .guide { margin-top: 22px; }
  .guide summary { list-style: none; cursor: pointer; }
  .guide summary::-webkit-details-marker { display: none; }
  .guide summary .tab-title { margin: 0; }
  .guide summary .tab-title::after { content: "▾"; margin-left: 6px; font-size: 12px; color: var(--gold-hi); }
  .guide:not([open]) summary .tab-title::after { content: "▸"; }
  .guide-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: center; margin-top: 14px; }
  .guide img { width: 100%; display: block; border-radius: 10px; border: 2px solid var(--bar-dark); }
  .guide ol { margin: 0; padding: 0; list-style: none; counter-reset: s; }
  .guide li { counter-increment: s; position: relative; padding: 6px 0 6px 38px; font-size: 14.5px; }
  .guide li::before { content: counter(s); position: absolute; left: 0; top: 5px; width: 26px; height: 26px; border-radius: 50%;
    background: var(--bar-dark); color: var(--gold-hi); font-family: var(--display); display: grid; place-items: center; font-size: 14px; }

  /* 온/오프 입력 카드 */
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
  .side { position: relative; border-top: 5px solid var(--c); }
  .side.on { --c: var(--on); --c-hi: var(--on-hi); --c-soft: var(--on-soft); }
  .side.off { --c: var(--off); --c-hi: var(--off-hi); --c-soft: var(--off-soft); }
  .side-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .side-badge { font-family: var(--display); font-size: 15px; color: #fff; padding: 4px 16px; background: linear-gradient(180deg, var(--c-hi), var(--c));
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); }
  .side-head h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 18px; }
  .side-head .hanja { margin-left: auto; font-family: var(--serif); font-size: 26px; color: var(--c); opacity: .25; font-weight: 700; }
  .drop { border: 2px dashed var(--line-strong); border-radius: 12px; min-height: 150px; display: flex; flex-direction: column; gap: 4px;
    align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer;
    background: var(--panel-2); padding: 10px; transition: border-color .15s, background .15s; }
  .drop:hover, .drop.over, .drop:focus-visible { border-color: var(--c); background: var(--c-soft); outline: none; }
  .drop b { color: var(--ink); font-size: 15px; }
  .drop img { max-width: 100%; max-height: 230px; display: block; border-radius: 8px; }
  .drop input { display: none; }
  .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  label { font-size: 13px; color: var(--muted); display: block; }
  input[type=number], input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--panel-2); color: var(--ink); font-size: 16px; margin-top: 3px; font-family: inherit; font-variant-numeric: tabular-nums; }
  input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
  .status { font-size: 13px; margin-top: 10px; min-height: 20px; color: var(--muted); }
  .status.err { color: var(--seal); font-weight: 700; }
  .stage { font-family: var(--serif); font-weight: 700; font-size: 15px; margin-top: 4px; }
  .rewards { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-top: 8px; }

  .expcard { margin-top: 16px; }
  .check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); cursor: pointer; flex-wrap: wrap; }
  .check input { width: 20px; height: 20px; accent-color: var(--gold); margin: 0; }
  .check .sub { font-size: 12px; color: var(--muted); }

  /* 분석하기: 게임 '입장' 버튼 느낌 */
  .analyze { text-align: center; }
  .analyze-btn { position: relative; width: 100%; max-width: 380px; padding: 16px 20px; border: 0; cursor: pointer; font-family: var(--display);
    font-size: 24px; letter-spacing: 2px; color: #fff; -webkit-text-stroke: 4px #12285a; paint-order: stroke fill;
    background: linear-gradient(180deg, #6aa2ff 0%, #3f74e6 48%, #2a55c4 52%, #3366d6 100%);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
    box-shadow: inset 0 0 0 3px #1c3a86; transition: transform .1s, filter .15s; }
  .analyze-btn:hover:not(:disabled) { filter: brightness(1.08); }
  .analyze-btn:active:not(:disabled) { transform: translateY(2px); }
  .analyze-btn:disabled { filter: grayscale(.85) brightness(.95); opacity: .55; cursor: not-allowed; }
  .analyze-hint { font-size: 13.5px; color: var(--muted); margin-top: 8px; min-height: 21px; }

  /* 비교 결과 */
  .results { margin-top: 18px; }
  .results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
  .results-head .tab-title { margin: 0; }
  .seg { display: inline-flex; border: 2px solid var(--bar-dark); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
  .seg button { border: 0; background: transparent; color: var(--ink); padding: 6px 14px; font-size: 14px; cursor: pointer; font-family: inherit; font-weight: 700; }
  .seg button + button { border-left: 1px solid var(--line-strong); }
  .seg button.active { background: var(--bar-dark); color: var(--gold-hi); }

  .verdict { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 20px 22px;
    border-radius: 12px; background: var(--v-soft); border: 2px solid var(--v); overflow: hidden; }
  .verdict.on { --v: var(--on); --v-soft: var(--on-soft); }
  .verdict.off { --v: var(--off); --v-soft: var(--off-soft); }
  .verdict.tie { --v: var(--tie); --v-soft: var(--panel-2); }
  .v-seal { width: 84px; height: 84px; border-radius: 12px; background: var(--v); color: #fff; display: grid; place-items: center;
    font-family: var(--serif); font-weight: 700; font-size: 44px; rotate: -6deg; box-shadow: 0 4px 0 rgba(0,0,0,.18);
    outline: 3px solid var(--v); outline-offset: 3px; }
  .v-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(26px, 5vw, 36px); line-height: 1.15; color: var(--v); }
  .v-sub { margin: 6px 0 0; font-family: var(--serif); font-size: 15px; }
  .v-sub b { color: var(--v); }
  .v-except { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
  .v-big { font-family: var(--display); font-size: 1.15em; }
  @media (max-width: 560px) { .verdict { grid-template-columns: 1fr; text-align: center; justify-items: center; } }

  .pace { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
  .pace div { border-radius: 10px; padding: 9px 12px; background: var(--panel-2); border-left: 4px solid var(--c); font-size: 13px; color: var(--muted); }
  .pace .on { --c: var(--on); } .pace .off { --c: var(--off); }
  .pace b { display: block; font-size: 18px; color: var(--c); font-variant-numeric: tabular-nums; }

  .legend { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin: 16px 0 4px; padding: 0 2px; }
  .legend .l { color: var(--on); } .legend .r { color: var(--off); }
  .tug { list-style: none; margin: 0; padding: 0; }
  .tug li { display: grid; grid-template-columns: 74px 1fr 112px; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px dashed var(--line); }
  .tug .name { font-weight: 700; font-size: 15px; }
  .track { position: relative; height: 14px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); }
  .track::after { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--bar-dark); translate: -1px 0; border-radius: 1px; }
  .track i { position: absolute; top: 1px; bottom: 1px; border-radius: 6px; }
  .track i.on { right: 50%; background: linear-gradient(270deg, var(--on-hi), var(--on)); }
  .track i.off { left: 50%; background: linear-gradient(90deg, var(--off-hi), var(--off)); }
  .amounts { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
  .badge { justify-self: end; font-weight: 700; font-size: 13.5px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .badge.on { color: var(--on); background: var(--on-soft); }
  .badge.off { color: var(--off); background: var(--off-soft); }
  .badge.tie { color: var(--tie); background: var(--panel-2); }
  @media (max-width: 560px) {
    .tug li { grid-template-columns: 1fr auto; row-gap: 6px; }
    .tug .bar-cell { grid-column: 1 / -1; grid-row: 2; }
  }
  .empty { color: var(--muted); font-size: 15px; padding: 26px 0; text-align: center; font-family: var(--serif); }

  .rules { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
  .rules summary { cursor: pointer; font-weight: 700; }
  .rules ul { margin: 8px 0 0; padding-left: 18px; }

  footer.foot { margin-top: 28px; text-align: center; font-family: var(--serif); color: var(--muted); font-size: 14px; }
  footer.foot .seal-sm { display: inline-grid; margin-bottom: 8px; }
  footer.foot b { color: var(--ink); }

  @media (max-width: 760px) {
    .grid, .guide-body { grid-template-columns: 1fr; }
    .hero-text { padding: 22px 14px; }
    .topbar-tag { display: none; }
  }
  @media (max-width: 400px) { .fields, .pace { grid-template-columns: 1fr; } }

/* 예시(placeholder) 글자는 연하게: 실제 입력값과 구분 */
input::placeholder { color: #b9ab93; opacity: 1; font-weight: 400; font-style: italic; }
input:placeholder-shown { background: #fffdf8; border-style: dashed; }
