:root { --ink: rgba(232, 238, 255, 0.88); --dim: rgba(232, 238, 255, 0.62); --glass: rgba(8, 16, 38, 0.42); --line: rgba(220, 230, 255, 0.16); --warm: rgba(255, 214, 150, 0.95);
    --font: 500 13px/1.35 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif; }
  html, body { margin: 0; height: 100%; background: #0b1630; overflow: hidden; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
  canvas { display: block; touch-action: none; }
  button { appearance: none; font: var(--font); color: var(--ink); cursor: pointer; }
  .line { position: fixed; left: 0; right: 0; padding: 0 16px; text-align: center; pointer-events: none; color: var(--ink);
    font: 500 14px/1.4 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); transition: opacity 0.8s ease; }
  #top { top: calc(env(safe-area-inset-top) + 58px); }   /* 위 모서리 버튼(둘러보기·별가루) 아래 줄 — 좁은 폰에서 겹친다 */
  #shower { top: calc(env(safe-area-inset-top) + 80px); font-size: 12px; color: var(--warm); }
  #whisper { bottom: calc(env(safe-area-inset-bottom) + 80px); opacity: 0; }
  #dust { position: fixed; top: calc(env(safe-area-inset-top) + 14px); right: 14px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--glass); color: var(--warm); font: var(--font); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  #zoom { position: fixed; top: calc(env(safe-area-inset-top) + 14px); left: 14px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--glass); color: var(--ink); font: var(--font); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  #bar { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 22px); display: flex; justify-content: center; gap: 8px; padding: 0 16px; }
  #bar button, .sheet button, #keys button { border: 1px solid var(--line); background: var(--glass); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  #bar button { padding: 10px 14px; border-radius: 999px; white-space: nowrap; }
  @media (max-width: 400px) { #bar { gap: 6px; padding: 0 8px; } #bar button { padding: 10px 11px; font-size: 14px; } }
  #bar button:active, .sheet button:active { background: rgba(255, 214, 150, 0.16); }
  #keys { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 74px); display: none; justify-content: center; gap: 5px; padding: 0 12px; }
  #keys.open { display: flex; }
  #keys button { width: 32px; height: 74px; border-radius: 10px 10px 16px 16px; color: var(--dim); font-size: 11px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
  #keys button.hit { background: rgba(255, 214, 150, 0.28); }
  #scrim { position: fixed; inset: 0; display: none; }
  #scrim.open { display: block; }
  .sheet { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 76px); max-width: 420px; margin: 0 auto; padding: 14px; border-radius: 18px;
    border: 1px solid var(--line); background: rgba(8, 16, 38, 0.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink); font: var(--font); display: none; }
  .sheet.open { display: block; }
  .sheet h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
  .sheet p { margin: 0 0 12px; color: var(--dim); font-size: 12px; }
  .sheet .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet button { padding: 11px 12px; border-radius: 12px; text-align: left; }
  .sheet button small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
  .sheet button.cost small { color: var(--warm); }
  .sheet.top { top: calc(env(safe-area-inset-top) + 60px); bottom: auto; }
  .sheet input { box-sizing: border-box; width: 100%; padding: 12px; margin: 0 0 10px; border-radius: 12px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06); color: var(--ink); font: 500 15px/1.3 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif; outline: none; -webkit-user-select: text; user-select: text; }
  .sheet input:focus { border-color: rgba(255, 214, 150, 0.5); }
  .sheet .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  .sheet .chips button { padding: 7px 11px; border-radius: 999px; font-size: 12px; }
  .sheet .cta { display: block; width: 100%; text-align: center; padding: 12px; background: rgba(255, 214, 150, 0.18); border-color: rgba(255, 214, 150, 0.4); color: var(--warm); font-weight: 600; }
  #starcard { position: fixed; display: none; align-items: center; gap: 8px; max-width: calc(100vw - 16px); padding: 7px 8px 7px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: rgba(8, 16, 38, 0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--ink); font: var(--font); }
  #starcard.open { display: flex; }
  #starcard span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #starcard button { flex: none; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--dim); font-size: 11px; }
  #starcard button[hidden] { display: none; }
  .sheet .err { margin: -2px 0 10px; color: rgba(255, 170, 160, 0.95); font-size: 12px; min-height: 0; }
  .sheet .err:empty { display: none; }
  .sheet h4 { margin: 14px 0 8px; color: var(--dim); font-size: 12px; font-weight: 500; }
  .sheet .orbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
  .sheet .orb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; text-align: center; font-size: 12px; }
  .sheet .orb span { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 4px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
  .sheet .orb:active span { background: rgba(255, 214, 150, 0.16); }
  .sheet .orb img { max-width: 34px; max-height: 34px; }
  .sheet .orb i { display: block; width: 14px; height: 14px; border-radius: 50%; background: rgba(226, 255, 150, 0.95); box-shadow: 0 0 14px 6px rgba(226, 255, 150, 0.45); }
  .sheet .orb small { margin: 0; font-size: 10.5px; }
  .sheet .specials { display: flex; flex-wrap: wrap; gap: 6px; }
  .sheet .specials button { padding: 9px 12px; border-radius: 999px; font-size: 12.5px; }
  .sheet .specials em { margin-left: 6px; font-style: normal; font-size: 10.5px; color: var(--warm); }
  .sheet .looks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
  .sheet .looks button { display: flex; align-items: flex-end; justify-content: center; height: 62px; padding: 6px 2px 4px; border-radius: 12px; background: linear-gradient(180deg, rgba(120, 150, 170, 0.34), rgba(232, 190, 150, 0.32)); }
  .sheet .looks img { max-width: 100%; max-height: 50px; }
  .sheet .looks button.on { border-color: rgba(255, 214, 150, 0.85); box-shadow: 0 0 0 1px rgba(255, 214, 150, 0.5); }
  .sheet .specials button.on { border-color: rgba(255, 214, 150, 0.7); color: var(--warm); }

  /* 넓은 화면: 그림은 세로에 맞춰 가운데(폭 = 높이 × 768/1376). 모서리 버튼을 창 끝이 아니라 그림 위에 둔다. */
  @media (min-aspect-ratio: 3/4) {
    #zoom { left: calc(50vw - 27.9vh + 14px); }
    #dust { right: calc(50vw - 27.9vh + 14px); }
  }
