/* 잿빛 성채 — 게임 영역과 화면 위 표시. 숫자(색·크기)는 변수로 */
:root { --rg-page-w: 980px; }
.ak {
  --ak-ink: #EDE6D6; --ak-dim: #9A93A6; --ak-panel: rgba(14, 12, 20, .78); --ak-line: rgba(237, 230, 214, .16);
  --ak-hp: #D8363C; --ak-mp: #F0A63A; --ak-xp: #6CC4F5; --ak-btn: 58px; --ak-btn-big: 82px;
  position: relative; width: 100%; height: min(74svh, 660px); min-height: 380px;
  background: #07060A; color: var(--ak-ink); border-radius: 12px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  font-family: var(--rg-font-body, system-ui, sans-serif); text-align: left;
}
.ak:fullscreen { height: 100vh; border-radius: 0; }
.ak-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.ak-hud { position: absolute; inset: 0; pointer-events: none; }
.ak-hud button { pointer-events: auto; font-family: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* 체력·등불·경험치 */
.ak-vitals { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 8px; width: min(44%, 300px); }
.ak-lv { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ak-panel); border: 2px solid #C89B3C; font-family: var(--rg-font-display, inherit); font-size: 18px; color: #FFD98A; }
.ak-bars { flex: 1; display: grid; gap: 4px; }
.ak-bar { position: relative; height: 16px; border-radius: 8px; background: rgba(0, 0, 0, .6); border: 1px solid var(--ak-line); overflow: hidden; }
.ak-bar__fill { position: absolute; inset: 0; transform-origin: left center; transition: transform .12s linear; }
.ak-bar--hp .ak-bar__fill { background: linear-gradient(#F0666B, var(--ak-hp)); }
.ak-bar--mp { height: 10px; } .ak-bar--mp .ak-bar__fill { background: linear-gradient(#FFD27A, var(--ak-mp)); }
.ak-bar--xp { height: 5px; border-radius: 3px; } .ak-bar--xp .ak-bar__fill { background: var(--ak-xp); }
.ak-bar__text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; text-shadow: 0 1px 0 #000; font-variant-numeric: tabular-nums; }
.ak-bar__tag { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); font-size: 9px; font-weight: 800; opacity: .8; text-shadow: 0 1px 1px #000; }

/* 층·금화·작은 지도 */
.ak-side { position: absolute; right: 10px; top: 10px; display: grid; justify-items: end; gap: 6px; }
.ak-info { display: flex; gap: 6px; font-size: 13px; font-weight: 800; }
.ak-chip { padding: 4px 9px; border-radius: 999px; background: var(--ak-panel); border: 1px solid var(--ak-line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ak-chip--gold { color: #F5C542; }
.ak-map { width: 112px; height: 112px; border-radius: 8px; background: rgba(0, 0, 0, .5); border: 1px solid var(--ak-line); image-rendering: pixelated; }
.ak-tools { position: absolute; right: 10px; top: 164px; display: flex; gap: 6px; }
.ak-tool { min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 10px; background: var(--ak-panel); border: 1px solid var(--ak-line); font-size: 13px; font-weight: 800; }

/* 마을 길잡이(화면 밖 문 쪽 화살표) */
.ak-guide { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.ak-guide[hidden] { display: none; }
.ak-guide__arrow { position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; background: #5CE0D0; clip-path: polygon(100% 50%, 18% 4%, 38% 50%, 18% 96%); }
.ak-guide__name { position: absolute; top: 15px; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; background: var(--ak-panel); color: #BFF5EC; font-size: 12px; font-weight: 800; white-space: nowrap; }
.ak-guide.is-up .ak-guide__name { top: -37px; }
.ak-nosave { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: rgba(216, 54, 60, .18); color: #FFB4B0; font-size: 12px; font-weight: 700; word-break: keep-all; }
.ak-nosave[hidden] { display: none; }
/* 사이트 제목 글꼴 묶음에 '잿·빛' 글자가 없어 두 글꼴이 섞여 보이므로, 이 게임 제목은 본문 글꼴로 */
.rg-topbar .rg-topbar__title { font-family: var(--rg-font-body, system-ui, sans-serif); font-weight: 800; }

/* 알림·떠오르는 숫자 */
.ak-toasts { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); display: grid; justify-items: center; gap: 5px; width: max-content; max-width: 92%; }
.ak-toast { --c: var(--ak-ink); white-space: nowrap; padding: 6px 12px; border-radius: 8px; background: var(--ak-panel); border: 1px solid var(--c); color: var(--c); font-size: 13px; font-weight: 800; animation: ak-toast 2.6s both; word-break: keep-all; }
.ak-toast--big { font-size: 16px; padding: 8px 16px; }
.ak-toast--dim { border-color: var(--ak-line); color: var(--ak-dim); font-weight: 700; font-size: 12px; }
@keyframes ak-toast { 0% { opacity: 0; transform: translateY(8px); } 8%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
.ak-pops { position: absolute; inset: 0; overflow: hidden; }
.ak-pop { position: absolute; transform: translate(-50%, -50%); font-family: var(--rg-font-display, inherit); font-size: 18px; color: #FFF6E0; text-shadow: 0 2px 0 #000, 0 -1px 0 #000, 1px 0 0 #000, -1px 0 0 #000; /* 번지는 그림자는 처음 그릴 때 멈칫해서 또렷한 테두리로 */ animation: ak-pop .7s ease-out both; white-space: nowrap; }
.ak-pop--crit { font-size: 27px; color: #FFD166; }
.ak-pop--hurt { color: #FF6B6B; font-size: 21px; }
.ak-pop--gold { color: #F5C542; font-size: 14px; }
.ak-pop--heal { color: #4ADE80; }
@keyframes ak-pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 18% { opacity: 1; transform: translate(-50%, -70%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* 단추: 공격·휩쓸기·물약 */
.ak-acts { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: auto auto; align-items: end; gap: 10px; }
.ak-act { position: relative; width: var(--ak-btn); height: var(--ak-btn); padding: 0; border-radius: 50%; background: var(--ak-panel); border: 2px solid var(--ak-line); display: grid; place-items: center; font-size: 12px; font-weight: 800; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; }
.ak-act__key { display: block; font-size: 10px; font-weight: 700; color: var(--ak-dim); }
.ak-act--attack { width: var(--ak-btn-big); height: var(--ak-btn-big); grid-row: span 2; border-color: #C89B3C; font-size: 16px; background: rgba(120, 30, 30, .78); }
.ak-act--attack.is-down { transform: scale(.94); background: rgba(170, 45, 45, .9); }
.ak-act--sweep { border-color: #F0A63A; }
.ak-act--sweep::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .66); transform-origin: bottom; transform: scaleY(var(--cd, 0)); }
.ak-act--potion { border-color: var(--ak-hp); }
.ak-act.is-empty { opacity: .45; }
.ak-act.is-deny { animation: ak-deny .25s; }
@keyframes ak-deny { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ak-act__n { position: absolute; left: 0; right: 0; bottom: 5px; font-size: 11px; color: #FFD98A; }
.ak-act--potion > span { transform: translateY(-5px); }
.ak:not(.is-touch) .ak-acts { right: auto; left: 12px; grid-template-columns: repeat(3, auto); } /* 가운데 아래는 주인공이 걸어갈 바닥이라 비워 둔다 */
.ak:not(.is-touch) .ak-act--attack { width: var(--ak-btn); height: var(--ak-btn); grid-row: auto; font-size: 12px; }
.ak:not(.is-touch) .ak-act--potion .ak-act__key { display: none; }
.ak.is-touch .ak-act__key { display: none; }

/* 조이스틱(터치한 자리에 생긴다) */
.ak-stick { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(237, 230, 214, .28); background: rgba(237, 230, 214, .07); display: none; }
.ak-stick.is-on { display: block; }
.ak-stick__knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(237, 230, 214, .5); }

/* 맞았을 때·체력이 낮을 때 화면 가장자리 */
/* 붉은 가장자리 효과는 3D 화면 안에서 그린다(render3d.js). 캔버스 위에 CSS 로 덮으면 처음 켜질 때 0.5초 멈췄다 */

/* 장비 창·시작 화면 */
.ak-panel, .ak-start, .ak-over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 4, 8, .72); pointer-events: auto; padding: 10px; }
.ak-panel[hidden], .ak-start[hidden], .ak-over[hidden], .ak-note[hidden], .ak-tool[hidden] { display: none; }
.ak:not(.is-touch) .ak-keys--touch, .ak.is-touch .ak-keys--pc { display: none; }
.ak-card { width: min(100%, 380px); max-height: 100%; overflow-y: auto; padding: 16px; border-radius: 14px; background: #17141F; border: 1px solid var(--ak-line); text-align: center; }
.ak-card h2 { margin: 0 0 4px; font-weight: 800; font-size: 24px; color: #FFD98A; } /* 제목용 글꼴은 일부 글자만 들어 있어 섞여 보인다. 본문 글꼴을 굵게 쓴다 */
.ak-card p { margin: 6px 0; font-size: 14px; line-height: 1.5; color: #CFC8D8; word-break: keep-all; }
/* 수첩 창: 장비·가방 / 능력치 / 아이템 도감 / 몬스터 도감 */
.ak-book { width: min(100%, 560px); height: 100%; max-height: 560px; padding: 0; display: flex; flex-direction: column; overflow: hidden; text-align: left; }
.ak-book__head { flex: none; display: flex; align-items: stretch; gap: 4px; padding: 6px 6px 0; border-bottom: 1px solid var(--ak-line); }
.ak-tabs { flex: 1; display: flex; gap: 2px; min-width: 0; }
.ak-tabs button { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--ak-dim) !important; font-size: 13px; font-weight: 800; white-space: nowrap; }
.ak-tabs button.is-on { background: rgba(255, 255, 255, .08); color: #FFD98A !important; box-shadow: inset 0 -2px 0 #C89B3C; }
.ak-book__close { flex: none; width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: transparent; font-size: 18px; }
.ak-book__body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 12px; touch-action: pan-y; overscroll-behavior: contain; }
.ak-h { margin: 8px 0 6px; font-size: 13px; font-weight: 800; color: #CFC8D8; }
.ak-h span { font-weight: 700; color: var(--ak-dim); font-variant-numeric: tabular-nums; }
.ak-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--ak-dim); word-break: keep-all; }
.ak-gear, .ak-bag, .ak-dex { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.ak-gear { grid-template-columns: 1fr; }
.ak-gear__row, .ak-bag__row, .ak-dex__cell, .ak-mon { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); }
.ak-gear__slot { flex: none; width: 30px; font-style: normal; font-size: 11px; color: var(--ak-dim); }
.ak-gear__row b.is-none { color: #6E687A; font-weight: 600; font-size: 13px; }
.ak-item { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.ak-item__icon { --c: #8A8496; flex: none; width: 40px; height: 40px; border-radius: 8px; background: rgba(0, 0, 0, .35); border: 1px solid var(--c); color: #8A8496; display: grid; place-items: center; overflow: hidden; }
.ak-item__icon svg { width: 26px; height: 26px; display: block; }
.ak-item__icon img { width: 100%; height: 100%; display: block; object-fit: contain; }
.ak-dex__cell .ak-item__icon { border-color: transparent; }
.ak-item__body { min-width: 0; flex: 1; display: grid; gap: 1px; }
.ak-item__name { font-size: 13px; line-height: 1.3; word-break: keep-all; }
.ak-item__sub { font-size: 12px; color: #B9B2C6; font-variant-numeric: tabular-nums; }
.ak-item__sub em { font-style: normal; font-weight: 800; }
.ak-item__sub em.is-up { color: #4ADE80; } .ak-item__sub em.is-down { color: #F87171; }
.ak-el { --c: #9A93A6; display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); font-style: normal; font-size: 11px; font-weight: 800; white-space: nowrap; }
.ak-bag__acts { flex: none; display: flex; gap: 4px; }
.ak-bag__empty { padding: 10px; font-size: 13px; color: var(--ak-dim); }
.ak-mini { min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--ak-line); background: rgba(255, 255, 255, .06); font-size: 12px; font-weight: 800; white-space: nowrap; }
.ak-mini--go { background: #8E2A26; border-color: #C89B3C; }
.ak-mini--wide { width: 100%; margin-top: 8px; }
.ak-mini--up { flex: none; border-color: #C89B3C; color: #FFD98A !important; }
.ak-mini:disabled { opacity: .4; cursor: default; }
.ak-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0; font-size: 13px; }
.ak-stats dt { color: var(--ak-dim); white-space: nowrap; } .ak-stats dd { margin: 0; font-weight: 700; word-break: keep-all; font-variant-numeric: tabular-nums; }
.ak-dex { grid-template-columns: 1fr 1fr; }
.ak-dex--mons { grid-template-columns: 1fr; }
.ak-dex__desc { font-size: 12px; line-height: 1.45; color: #CFC8D8; word-break: keep-all; }
.ak-dex__cell.is-unknown, .ak-mon.is-unknown { opacity: .55; }
.ak-mon { align-items: flex-start; }
.ak-mon__img { flex: none; width: 72px; height: 72px; border-radius: 8px; background: rgba(0, 0, 0, .35); }
.ak-mon.is-unknown .ak-mon__img { filter: brightness(0) opacity(.55); }
.ak-mon__body { min-width: 0; flex: 1; display: grid; gap: 3px; }
.ak-mon__tags .ak-el { margin: 0 4px 0 0; }
/* 우두머리 체력: PC 는 위 가운데, 휴대폰은 왼쪽 아래(조이스틱 자리 위는 비어 있다) */
.ak-boss { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); width: min(34%, 320px); text-align: center; }
.ak-boss[hidden] { display: none; }
.ak-boss__name { display: block; margin-bottom: 3px; font-size: 13px; font-weight: 800; color: #FFB08A; text-shadow: 0 1px 0 #000; }
/* 시작할 때 잠깐: 화면 위 표시들을 거의 안 보이게 한 번 그려 둔다(처음 뜰 때 멈칫하지 않게) */
.ak-warm .ak-boss[hidden] { display: block; opacity: .02; }
.ak-warm__item { animation: none !important; opacity: .02 !important; }
.ak-bar--boss { height: 12px; } .ak-bar--boss .ak-bar__fill { background: linear-gradient(#FF9A5C, #C2410C); }
.ak.is-touch .ak-boss { left: 12px; top: auto; bottom: 16px; transform: none; width: 46%; text-align: left; }
.ak-go + .ak-go { margin-top: 6px; }
/* 원정(파밍): 맵 선택과 완료 화면 */
.ak-mapsel { width: min(100%, 560px); text-align: left; touch-action: pan-y; }
.ak-mapsel h2, .ak-mapsel > p { text-align: center; }
.ak-maps { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.ak-farm { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.ak-farm__body { min-width: 0; flex: 1; display: grid; gap: 2px; font-size: 12px; line-height: 1.45; color: #CFC8D8; word-break: keep-all; }
.ak-farm__body b { font-size: 15px; color: #FFD98A; }
.ak-farm__info { color: #7DD3FC; font-weight: 700; font-variant-numeric: tabular-nums; }
.ak-farm__acts { flex: none; display: flex; gap: 4px; }
.ak-farm__acts .ak-mini { min-width: 44px; padding: 0 8px; font-size: 14px; }
.ak-tool--farm { border-color: #F2B632; color: #FFD98A !important; }
.ak-tool[hidden] { display: none; }
.ak-info { justify-content: flex-end; } /* 넓은 화면에서는 한 줄(두 줄이 되면 작은 지도가 밀려 단추와 겹친다) */
/* 장비 창(등불지기 그림 + 입은 장비), 보석 홈, 숙련, 창고 */
.ak-doll { display: flex; gap: 10px; align-items: flex-start; }
.ak-doll__img { flex: none; width: 120px; height: 120px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #3A2F2A, #17141F 75%); border: 1px solid var(--ak-line); }
.ak-doll__body { flex: 1; min-width: 0; }
.ak-gear__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ak-gear__row.is-pick { outline: 1px dashed #F2B632; }
.ak-socks { display: flex; flex-wrap: wrap; gap: 4px; }
.ak-sock { --c: #9A93A6; min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--c); background: rgba(0, 0, 0, .3); color: var(--c) !important; font-size: 12px; font-weight: 800; text-align: left; }
.ak-sock--empty { border-style: dashed; }
.ak-el--sock { --c: #B9B2C6; }
.ak-gem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); }
.ak-gem__dot { flex: none; width: 26px; text-align: center; font-size: 20px; }
.ak-mastery { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 5px; }
.ak-mastery__row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); font-size: 12px; color: #CFC8D8; }
.ak-mastery__row b { font-size: 13px; color: #FFD98A; }
.ak-mastery__head { margin: 4px 0; font-size: 13px; font-weight: 800; color: #7DD3FC; }
.ak-tool--stash { border-color: #C89B3C; color: #FFD98A !important; }
.ak-tool.has-pts { border-color: #7DD3FC; box-shadow: 0 0 0 2px rgba(125, 211, 252, .35); }
.ak-lv[data-m]:not([data-m=""])::after { content: attr(data-m); position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 1px; padding: 0 5px; border-radius: 999px; background: #17141F; border: 1px solid #7DD3FC; color: #7DD3FC; font-family: var(--rg-font-body, system-ui, sans-serif); font-size: 10px; font-weight: 800; white-space: nowrap; }
.ak-lv { position: relative; }
.ak.is-maxlv .ak-bar--xp .ak-bar__fill { background: #7DD3FC; }
.ak-tool.has-new { border-color: #4ADE80; box-shadow: 0 0 0 2px rgba(74, 222, 128, .35); }
.ak-pop--weak { font-size: 24px; }
.ak-pop--resist { font-size: 14px; color: #9A93A6; }
.ak-pop--weak.ak-pop--crit { font-size: 32px; }
.ak-pop--resist.ak-pop--crit { font-size: 20px; color: #C9C2D6; }
.ak-toast--note { font-size: 12px; padding: 4px 10px; font-weight: 700; }
/* 게임·도감 사이를 오가는 구역 메뉴(이 게임만의 탭) */
.ak-nav { display: flex; gap: 6px; max-width: var(--rg-page-w); margin: 0 auto 10px; padding: 0 2px; }
.ak-nav a { flex: 1; min-height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--rg-surface, #fff); border: 1px solid var(--rg-line, #E5E7EB); color: var(--rg-ink, #1E2430); font-size: 14px; font-weight: 800; text-decoration: none; }
.ak-nav a.is-on { background: #17141F; border-color: #17141F; color: #FFD98A; }
.ak-nav--bottom { display: none; margin-top: 10px; }
.ak-keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; text-align: left; font-size: 13px; color: #CFC8D8; }
.ak-keys dt { font-weight: 800; color: var(--ak-ink); white-space: nowrap; } .ak-keys dd { margin: 0; }
.ak-go { width: 100%; min-height: 56px; margin-top: 8px; border: 0; border-radius: 12px; background: #B3322D; color: #fff !important; font-size: 18px; font-weight: 800; }
.ak-go--plain { background: #2B2735; min-height: 48px; font-size: 15px; }
.ak-note { position: absolute; left: 10px; top: 66px; max-width: 60%; margin: 0; padding: 4px 10px; border-radius: 8px; background: var(--ak-panel); font-size: 12px; color: var(--ak-dim); word-break: keep-all; }
.ak-help { max-width: 640px; margin: 14px auto 0; padding: 0 12px; font-size: 14px; line-height: 1.6; color: var(--rg-ink-2, #4B5563); text-align: left; word-break: keep-all; }
.ak-help h2 { font-size: 16px; margin: 12px 0 4px; }

@media (max-width: 520px) {
  .ak { height: min(76svh, 640px); border-radius: 0; }
  .ak-map { width: 84px; height: 84px; }
  .ak-tools { right: auto; left: 10px; top: 66px; }
  .ak-note { top: 116px; }
  .ak-toasts { top: 122px; }
  .ak-toast { font-size: 12px; padding: 5px 10px; } .ak-toast--big { font-size: 14px; padding: 6px 12px; }
  .ak-card { padding: 12px; } .ak-book { padding: 0; }
  .ak-gear, .ak-dex { grid-template-columns: 1fr; }
  .ak-tabs { flex-wrap: wrap; } .ak-tabs button { flex: 1 0 30%; font-size: 12px; white-space: normal; word-break: keep-all; line-height: 1.15; } /* 좁으면 '아이템 도감'을 두 줄로 */
  .ak-bag__row { flex-wrap: wrap; } .ak-bag__acts { width: 100%; } .ak-bag__acts .ak-mini { flex: 1; }
  .ak-doll { flex-direction: column; align-items: stretch; } .ak-doll__img { width: 84px; height: 84px; align-self: center; }
  #akPaneGear:not([hidden]) { display: flex; flex-direction: column; } #akPaneGear.is-picking .ak-doll { order: 2; } #akPaneGear .ak-hint--foot { order: 3; } /* 좁은 화면: 빈 홈을 누르면 가진 보석을 위로(멀리 내리지 않게) */
  .ak-gear__row { flex-wrap: wrap; } .ak-gear__row .ak-mini--up { margin-left: auto; }
  .ak-gem { flex-wrap: wrap; } .ak-mastery__row { grid-template-columns: 64px 1fr auto; }
  .ak-farm { flex-wrap: wrap; } .ak-farm__acts { width: 100%; } .ak-farm__acts .ak-mini { flex: 1; }
  .ak-chip { font-size: 12px; padding: 3px 8px; }
  .ak-info { flex-wrap: wrap; max-width: 50%; } /* 좁은 휴대폰: 층 표시가 길면 금화를 아랫줄로(단추는 왼쪽에 있어 겹치지 않는다) */
}
@media (max-height: 460px) and (orientation: landscape) {
  .ak { height: calc(100svh - 78px); min-height: 250px; }
  .ak-card { padding: 8px 14px; width: min(100%, 520px); } .ak-card h2 { font-size: 18px; margin: 0; } .ak-card p, .ak-keys { margin: 3px 0; font-size: 12px; } .ak-go { min-height: 44px; margin-top: 4px; }
  .ak-start.has-save .ak-keys, .ak-start.has-save .ak-card > p { display: none; } /* 저장이 있으면 단추가 여럿이라 안내는 접는다 */
  .ak-nav--top { display: none; } .ak-nav--bottom { display: flex; } /* 낮은 가로 화면: 게임이 한 화면에 들어오게 메뉴는 아래로 */
  .ak-book { padding: 0; width: min(100%, 720px); } .ak-book__body { padding: 6px 10px 8px; } .ak-h { margin: 4px 0; }
  .ak-toasts { top: 58px; } .ak-toast { font-size: 12px; padding: 4px 10px; } .ak-toast--big { font-size: 13px; }
  .ak-act { font-size: 11px; }
  .ak-map { width: 78px; height: 78px; }
  .ak-tools { right: auto; left: 10px; top: 62px; } /* 오른쪽은 단추 자리라 왼쪽 위로 */
  .ak { --ak-btn: 52px; --ak-btn-big: 72px; }
}

/* ── 6단계: 캐릭터 고르기·이름, 기술 단추, 귀환, 기술·상점 탭 ── */
.ak-tools { flex-wrap: wrap; max-width: calc(100% - 20px); }
.ak-tool--portal { border-color: #7DD3FC; color: #BFE8FF !important; }
.ak-tool--portal.is-back { border-color: #5CE0D0; box-shadow: 0 0 0 2px rgba(92, 224, 208, .35); }
.ak-tool--portal.is-cast { animation: ak-cast .5s infinite alternate; }
.ak-tool--portal:disabled { opacity: .45; }
.ak-tool--shop { border-color: #4ADE80; color: #B8F5CC !important; }
@keyframes ak-cast { from { box-shadow: 0 0 0 0 rgba(125, 211, 252, .6); } to { box-shadow: 0 0 0 6px rgba(125, 211, 252, 0); } }
.ak-act--skill { white-space: normal; word-break: keep-all; }
.ak-act--skill2 { border-color: #7DD3FC; }
.ak-act--skill2::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .66); transform-origin: bottom; transform: scaleY(var(--cd, 0)); }
.ak-act.is-locked { opacity: .4; border-style: dashed; }
.ak.is-buff .ak-bar--hp { box-shadow: 0 0 0 2px #7DD3FC; }
.ak .ak-act--attack { grid-row: auto; }
.ak:not(.is-touch) .ak-acts { grid-template-columns: repeat(4, auto); }
.ak-classes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 4px; }
.ak-class { min-height: 64px; padding: 6px 4px; border-radius: 10px; border: 2px solid var(--ak-line); background: #201C2A; color: var(--ak-ink) !important; font-size: 13px; line-height: 1.25; display: grid; gap: 2px; align-content: center; }
.ak-class__name { font-size: 15px; font-weight: 800; }
.ak-class__role { font-style: normal; font-size: 11px; color: var(--ak-dim); }
.ak-class__save { font-style: normal; font-size: 11px; color: #FFD98A; }
.ak-class.is-on { border-color: var(--c, #C89B3C); background: #2A2436; box-shadow: 0 0 0 2px rgba(200, 155, 60, .25); }
.ak-card p.ak-classdesc { font-size: 12px; margin: 2px 0 6px; min-height: 36px; }
.ak-namebox { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; font-weight: 800; }
.ak-name { flex: 1; min-width: 0; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--ak-line); background: #0F0D15; color: var(--ak-ink); font-size: 16px; font-family: inherit; }
.ak-name:focus { outline: 2px solid #C89B3C; outline-offset: 1px; }
.ak-skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ak-skill { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.ak-skill__key { grid-row: span 2; min-width: 44px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--ak-line); text-align: center; font-size: 12px; font-weight: 800; color: #FFD98A; }
.ak-skill__name { font-size: 14px; } .ak-skill__text { font-size: 12px; color: #CFC8D8; line-height: 1.4; word-break: keep-all; }
.ak-skill.is-locked { opacity: .55; }
.ak-el--cls { --c: #E5484D; }
.ak-shop__price { color: #FFD98A; font-weight: 800; white-space: nowrap; }
@media (max-width: 520px) {
  .ak-tabs button { flex: 1 0 22%; }
  .ak-tools { max-width: calc(100% - 114px); } /* 오른쪽 작은 지도(84px) 자리는 비운다 */
  .ak.is-tools2 .ak-toasts { top: 172px; } /* 도구 단추가 두 줄일 때만(안전지대의 상인·창고 옆) 알림을 그 아래로 */
  .ak-tool { padding: 0 6px; font-size: 12px; } .ak-tools { gap: 5px; } /* 360 폭에서 인벤토리·귀환·원정·전체 화면이 한 줄에 */
  .ak-card p.ak-classdesc { min-height: 0; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .ak-classes { margin: 3px 0; } .ak-class { min-height: 44px; padding: 3px 4px; gap: 0; } .ak-class__role { display: none; } .ak-card p.ak-classdesc { display: none; } /* 낮은 화면: 역할 글은 접고 이름과 진행만 */
  .ak-namebox { margin: 2px 0; }
  .ak-start.has-save .ak-card > p.ak-classdesc { display: none; }
}
