/* DOM 은 배너 / 자랑 카드 / 상점 시트 / 회전 안내뿐. 나머지는 전부 캔버스. */

/* SSRO 물방울체 — 서울시립청소년미디어센터(ssro.net), 유정연 디자인, 2024.
   업로드받은 OTF(490KB)를 woff2 로 바꿔 227KB. 한글 2350자(KS X 1001) 전부 들어 있다.
   swap: 폰트가 늦게 와도 글자는 먼저 보인다. 첫 탭이 폰트를 기다릴 이유가 없다. */
@font-face {
  font-family: 'WaterDrop';
  src: url('assets/waterdrop.woff2') format('woff2');
  /* Regular 한 벌뿐이지만 굵기 범위를 넓게 선언한다. normal 로 두면 브라우저가 700 을
     합성 볼드로 만드는데, 원래 획이 두꺼운 폰트라 글자가 뭉개진다(실제로 해보고 되돌림).
     위계는 크기와 색으로만 잡는다. */
  font-weight: 100 900;
  font-display: swap;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1d1713;
  /* 연타 중에 선택·확대·하이라이트가 끼어들면 손맛이 끊긴다 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
  font: 500 15px/1.5 'WaterDrop', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
        "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: #eef6fa;
}

#stage { display: block; width: 100%; height: 100%; touch-action: none; }

/* --- 해금 배너 --------------------------------------------------------- */
#banner {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translate(-50%, -140%);
  max-width: 88vw;
  padding: 9px 16px;
  border-radius: 0 0 14px 14px;
  background: rgba(20, 28, 34, 0.88);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-top: 0;
  white-space: nowrap;
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;      /* 손이 멈추면 세션이 끝난다. 배너는 탭을 절대 안 막는다 */
  z-index: 4;
}
#banner.on { transform: translate(-50%, 0); }
#banner b { font-weight: 800; color: #ffd98a; margin-right: 8px; }
#banner i { font-style: normal; opacity: .78; font-size: 13px; }

/* --- 자랑 카드 ---------------------------------------------------------- */
#card {
  position: fixed;
  left: 50%;
  top: 21%;
  transform: translate(-50%, 0) scale(.86);
  opacity: 0;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .3, 1.3);
  pointer-events: none;      /* 카드가 떠 있어도 뒤의 뽁뽁이는 계속 터진다 */
  z-index: 5;
  text-align: center;
}
#card.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
#card canvas {
  width: 250px; height: 160px;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
}
#card .btns { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
#card.on .btns button { pointer-events: auto; }
#card button {
  font: 600 13px/1 inherit; color: #eef6fa;
  background: rgba(24, 32, 40, .92);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px; padding: 8px 15px;
}

/* --- 상점 --------------------------------------------------------------- */
#shopbtn {
  position: fixed; right: 12px; bottom: 12px;
  transition: opacity .18s ease, transform .18s ease;
  font: 700 14px/1 inherit; color: #12181d;
  background: linear-gradient(180deg, #cfe9f2, #9dc6d6);
  border: 0; border-radius: 999px; padding: 12px 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  z-index: 3;
}
/* 상점이 열리면 시트가 이 버튼을 덮는다 (같은 z-index 에 DOM 이 뒤라서).
   그때는 버튼을 치우고, 닫는 일은 시트 안의 손잡이가 맡는다. */
#shopbtn.hide { opacity: 0; transform: translateY(24px); pointer-events: none; }

#shopclose {
  display: block; width: 100%; height: 26px;
  margin: -6px 0 8px; padding: 0;
  background: transparent; border: 0; position: relative;
}
#shopclose::before {
  content: ''; position: absolute; left: 50%; top: 9px;
  transform: translateX(-50%);
  width: 46px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, .30);
}
#shopclose:active::before { background: rgba(255, 255, 255, .55); }

#shop {
  position: fixed; left: 0; right: 0; bottom: 0;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.1);
  background: rgba(16, 22, 27, .95);
  border-top: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px 18px 0 0;
  padding: 14px 12px calc(12px + env(safe-area-inset-bottom));
  max-height: 46vh; overflow-y: auto;
  z-index: 3;
}
#shop.on { transform: translateY(0); }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
}
.item.can { background: rgba(140, 220, 255, .12); border-color: rgba(140, 220, 255, .3); }
.item .n { flex: 1; min-width: 0; }
.item .n b { display: block; font-weight: 700; }
.item .n span { font-size: 12px; opacity: .65; }
.item .c { font-weight: 700; font-size: 13px; text-align: right; }
.item .c em { display: block; font-style: normal; font-size: 11px; opacity: .6; font-weight: 500; }

#resetbtn {
  display: block; width: 100%;
  margin-top: 6px; padding: 11px;
  font: 600 13px/1 inherit; color: rgba(255, 150, 150, .78);
  background: rgba(255, 90, 90, .07);
  border: 1px solid rgba(255, 110, 110, .22);
  border-radius: 12px;
}
/* 한 번 눌러 무장된 상태. 3초 안에 다시 누르면 지운다 */
#resetbtn.arm {
  color: #fff;
  background: rgba(220, 60, 60, .82);
  border-color: rgba(255, 140, 140, .5);
}

#rotate {
  display: none; position: fixed; inset: 0; background: #1d1713;
  align-items: center; justify-content: center; text-align: center;
  font-weight: 600; font-size: 17px; z-index: 10;
}
@media (orientation: landscape) and (max-height: 520px) {
  #resetbtn {
  display: block; width: 100%;
  margin-top: 6px; padding: 11px;
  font: 600 13px/1 inherit; color: rgba(255, 150, 150, .78);
  background: rgba(255, 90, 90, .07);
  border: 1px solid rgba(255, 110, 110, .22);
  border-radius: 12px;
}
/* 한 번 눌러 무장된 상태. 3초 안에 다시 누르면 지운다 */
#resetbtn.arm {
  color: #fff;
  background: rgba(220, 60, 60, .82);
  border-color: rgba(255, 140, 140, .5);
}

#rotate { display: flex; }
}
