@import url('/css/theme.css');

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.55 var(--font); color: var(--ink); background: var(--sky); min-height: 100vh; -webkit-font-smoothing: antialiased; letter-spacing: -.01em; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.02em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; }
img.logo-img { display: block; }

/* ───────── 입장 ───────── */
.enter-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: var(--dots), linear-gradient(180deg, #f4fbff, var(--sky)); }
.enter-box { overflow: hidden; width: 100%; max-width: 440px; background: #fff; border-radius: 28px; box-shadow: var(--shadow-lg); padding: 34px 28px 28px; display: grid; gap: 16px; text-align: center; position: relative; animation: pop-in .35s ease-out; }
.enter-box::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; border-radius: 28px 28px 0 0; background: linear-gradient(90deg, var(--green), var(--cyan), var(--blue), var(--purple), var(--pink), var(--yellow)); }
.enter-box .mascot { width: 92px; height: 92px; margin: 0 auto; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(48, 100, 236, .2)); }
.enter-box h1 { font-size: 28px; font-weight: 900; color: var(--ink); }
.enter-box h1 span { color: var(--blue); }
.enter-box p { margin: 0; color: var(--ink-2); font-size: 15px; }
.code-input { font: 800 30px/1 "Consolas", "D2Coding", var(--font); letter-spacing: 8px; text-align: center; text-transform: uppercase; padding: 16px 12px; border: 3px solid var(--sky-2); background: var(--sky); border-radius: 18px; width: 100%; color: var(--ink); transition: border-color .15s, background .15s; }
.code-input::placeholder { color: var(--sky-3); }
.code-input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 5px var(--blue-l); }
.enter-box .blk { width: 100%; }
.error-msg { color: var(--red); font-weight: 800; font-size: 14px; background: var(--red-l); border-radius: 12px; padding: 8px 12px; }
.error-msg:empty { display: none; }
.enter-foot { font-size: 12px; color: var(--muted); }

/* ───────── 위 막대 ───────── */
.top { background: var(--blue); color: #fff; box-shadow: 0 2px 0 var(--blue-d); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.brand { font-weight: 900; font-size: 19px; display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; color: #fff; text-decoration: none; letter-spacing: -.03em; }
.brand img { width: 36px; height: 36px; background: #fff; border-radius: 12px; padding: 3px; }
.me { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; }
.me .nick { opacity: .95; }
.dday { background: #fff; color: var(--blue); padding: 4px 11px; border-radius: 999px; font-weight: 900; font-size: 13px; }
.dday.soon { background: var(--yellow); color: var(--ink); }

/* ───────── 로비 ───────── */
.main { max-width: 1160px; margin: 0 auto; padding: 22px 16px 70px; display: grid; gap: 22px; }
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 28px 30px; color: #fff; background: linear-gradient(120deg, #4f80ff 0%, #6a6cff 55%, #ad3efb 100%); box-shadow: var(--shadow); display: flex; align-items: center; gap: 20px; min-height: 150px; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .25), transparent 40%), radial-gradient(circle, rgba(255, 255, 255, .12) 1.4px, transparent 1.5px) 0 0 / 24px 24px; pointer-events: none; }
.hero-text { position: relative; z-index: 1; flex: 1; }
.hero h2 { font-size: 30px; font-weight: 900; }
.hero p { margin: 6px 0 0; font-size: 16px; opacity: .92; font-weight: 600; }
.hero .mascot { position: relative; z-index: 1; width: 110px; height: 110px; animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .2)); }
.seg { display: inline-flex; background: #fff; border-radius: 18px; padding: 5px; box-shadow: var(--shadow); gap: 4px; justify-self: start; }
.seg button { border: 0; background: transparent; padding: 10px 20px; border-radius: 13px; font-weight: 800; font-size: 15px; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { background: var(--sky); }
.seg button.on { background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); }

.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.kit { --kc: var(--blue); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-rows: auto 1fr; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; position: relative; }
.kit:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.kit:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }
.kit .thumb { aspect-ratio: 4 / 3; background: var(--dots), var(--sky) ; background-size: 22px 22px, cover; display: grid; place-items: center; font-size: 56px; position: relative; }
.kit .thumb.has-img { background: center / cover no-repeat; }
.kit .body { padding: 14px 18px 18px; display: grid; gap: 7px; align-content: start; }
.kit h3 { font-size: 19px; font-weight: 900; }
.kit .sub { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
/* 분류 표: 블록 모양 */
.cat { justify-self: start; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: #fff; background: var(--kc); padding: 3px 10px 3px 8px; border-radius: 8px 8px 8px 2px; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.kit-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { justify-self: start; width: fit-content; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--sky); color: var(--ink-2); }
.tag.done { background: var(--mint-l); color: #0b8a66; }
.tag.doing { background: var(--yellow-l); color: #9a6a00; }
.tag.new { background: var(--blue-l); color: var(--blue-d); }
.empty { text-align: center; padding: 44px 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink-2); font-weight: 600; }

/* ───────── 마이 월드 ───────── */
.world-shelf { background: #fff; border-radius: 28px; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 18px; }
.world-head { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.world-head h2 { color: var(--ink); font-size: 23px; font-weight: 900; flex: 1; }
.world-stats { display: flex; gap: 10px; }
.world-stats span { background: var(--sky); border-radius: 16px; padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center; min-width: 88px; }
.world-stats b { font-size: 22px; font-weight: 900; color: var(--blue); display: block; }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.trophy { border-radius: 20px; background: #fff; border: 2px solid var(--line); padding: 14px; display: grid; gap: 8px; align-content: start; }
.trophy.done { border-color: var(--mint); box-shadow: 0 4px 0 var(--mint-l); }
.trophy .thumb { aspect-ratio: 16 / 10; border-radius: 14px; background: var(--dots), var(--sky); display: grid; place-items: center; font-size: 40px; }
.trophy .thumb.has-img { background: center / cover no-repeat; }
.trophy h3 { font-size: 17px; font-weight: 900; }
.trophy ul { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); display: grid; gap: 3px; }
.trophy li::before { content: "• "; color: var(--blue); font-weight: 900; }
.trophy .blk { justify-self: start; }
.trophy .thumb { position: relative; }
.trophy .thumb.is-photo { box-shadow: inset 0 0 0 4px #fff, 0 3px 0 var(--line); }
.photo-tag { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 800; background: rgba(255, 255, 255, .92); color: var(--ink); padding: 3px 8px; border-radius: 999px; }
.t-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t-name h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-edit { flex: none; border: 0; background: var(--sky); border-radius: 10px; width: 32px; height: 32px; cursor: pointer; font-size: 15px; }
.t-edit:hover { background: var(--blue-l); }
.t-rename { display: flex; gap: 6px; }
.t-rename input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; font: inherit; font-weight: 700; }
.t-rename input:focus { outline: none; border-color: var(--blue); }
.t-kit { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: -6px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { border: 2px dashed var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 2px 9px 2px 4px; font: inherit; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.badge i { font-style: normal; font-size: 15px; filter: grayscale(1); opacity: .45; }
.badge.got { border-style: solid; border-color: var(--yellow); background: var(--yellow-l); color: #7a5600; }
.badge.got i { filter: none; opacity: 1; }
.badge.on { outline: 2px solid var(--blue); outline-offset: 1px; }
.badge-how { margin: -2px 0 0; font-size: 12px; color: var(--ink-2); font-weight: 600; min-height: 1.4em; }

/* ───────── 키트 실행 ───────── */
.kit-page { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.kit-bar { background: var(--blue); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 12px; box-shadow: 0 2px 0 var(--blue-d); z-index: 10; }
.kit-bar h1 { font-size: 17px; font-weight: 900; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.kit-bar h1 img { width: 30px; height: 30px; background: #fff; border-radius: 10px; padding: 2px; flex: none; }
#kit-root { position: relative; overflow: hidden; background: var(--sky); }
.kit-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; font-weight: 700; color: var(--ink-2); }

@media (max-width: 640px) {
  .hero { padding: 22px 20px; border-radius: 22px; }
  .hero h2 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .hero .mascot { width: 72px; height: 72px; }
  .world-stats span { min-width: 0; padding: 6px 10px; }
}
@media (max-width: 520px) {
  .enter-box { padding: 30px 18px 22px; }
  .code-input { font-size: 26px; letter-spacing: 5px; }
  .me .nick { display: none; }
  .brand { font-size: 16px; }
  .kit-bar { gap: 6px; padding: 6px 8px; }
  .kit-bar h1 { font-size: 15px; }
  .kit-bar h1 img { display: none; }
  .seg button { padding: 9px 14px; }
}

/* ───────── 인터넷 끊김 표시 (net.js) ───────── */
.net-chip { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1000; max-width: calc(100% - 24px); background: var(--blue); color: #fff; font-size: 13px; font-weight: 800; padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 0 var(--blue-d), 0 8px 24px rgba(0, 0, 0, .18); text-align: center; pointer-events: none; }
.net-chip.off { background: var(--ink); box-shadow: 0 4px 0 #000, 0 8px 24px rgba(0, 0, 0, .25); }
.net-chip[hidden] { display: none; }
