/* ===== 작전 단말기 =====
 * 통신 화면(style.css)의 HUD 디자인 언어를 이어받는다.
 * 딥네이비·블랙 바탕, 홀로그램 블루와 네온 그린 포인트.
 */
:root {
  --t-bg: #000a14;
  --t-panel: rgba(6, 22, 40, .82);
  --t-panel-2: rgba(10, 32, 58, .9);
  --t-line: rgba(0, 183, 255, .28);
  --t-line-strong: rgba(0, 183, 255, .6);
  --t-text: #eaf6ff;
  --t-sub: rgba(234, 246, 255, .66);
  --t-blue: #00b7ff;
  --t-blue-2: #2870ff;
  --t-green: #00DC84;
  --t-violet: #6f36ff;
  --t-warn: #ffb547;
  --t-danger: #ff4d6d;
  --nav-h: 68px;
  --top-h: 92px;
}

body:not([data-state="idle"]) .terminal { display: none; }

.terminal {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(40, 112, 255, .22), transparent 60%),
    radial-gradient(80% 50% at 100% 100%, rgba(111, 54, 255, .14), transparent 60%),
    var(--t-bg);
  color: var(--t-text);
  z-index: 1;
}
.terminal::before {
  /* 미세한 격자 */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 183, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 183, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}

/* ----- 상단 고정 ----- */
.term-top {
  position: relative;
  flex: none;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  border-bottom: 1px solid var(--t-line);
  background: linear-gradient(to bottom, rgba(0, 10, 20, .96), rgba(0, 10, 20, .82));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 3;
}
.term-top__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.term-top__row + .term-top__row { margin-top: 4px; }
.term-top__cmd { font-size: 11px; letter-spacing: .22em; color: var(--t-blue); }
.term-top__agent {
  font-size: 13px; font-weight: 700; color: var(--t-green);
  display: inline-flex; align-items: center; gap: 6px;
}
.term-top__agent::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--t-green); box-shadow: 0 0 8px var(--t-green); }
.term-top__title { margin: 2px 0 6px; font-size: clamp(18px, 5.6vw, 22px); font-weight: 700; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-chip {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--t-line-strong);
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--t-blue);
  background: rgba(0, 183, 255, .08);
  white-space: nowrap;
}
.term-chip[data-status="active"] { color: var(--t-green); border-color: rgba(0, 220, 132, .6); background: rgba(0, 220, 132, .08); }
.term-chip[data-status="pending"] { color: var(--t-warn); border-color: rgba(255, 181, 71, .55); background: rgba(255, 181, 71, .08); }
.term-top__status { gap: 12px; }
.term-progress { flex: 1; min-width: 40px; height: 3px; border-radius: 2px; background: rgba(0, 183, 255, .15); overflow: hidden; }
.term-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--t-blue), var(--t-green)); box-shadow: 0 0 8px var(--t-green); transition: width .6s ease; }

body[data-mode="test"] .term-top::after {
  content: 'TEST MODE · 실제 게임과 별도 저장';
  position: absolute; right: 0; bottom: -20px; left: 0;
  padding: 2px 0;
  background: repeating-linear-gradient(-45deg, rgba(255, 181, 71, .95) 0 10px, rgba(255, 160, 40, .95) 10px 20px);
  color: #1a1000; font-size: 11px; font-weight: 700; text-align: center; letter-spacing: .08em;
}
body[data-mode="test"] .term-view { padding-top: 32px; }

/* ----- 본문 ----- */
.term-view {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* 하단 메뉴에 가려지지 않도록 스크롤 영역을 메뉴 위에서 끝낸다 */
  margin-bottom: calc(var(--nav-h) + var(--safe-b));
  padding: 14px 16px 24px;
  outline: none;
  z-index: 1;
}
.view { display: flex; flex-direction: column; gap: 12px; max-width: 560px; margin: 0 auto; animation: view-in .28s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----- 하단 고정 내비게이션 ----- */
.term-nav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(var(--safe-b) + 6px);
  border-top: 1px solid var(--t-line);
  background: rgba(0, 10, 20, .94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 4;
}
.term-nav__btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 56px;
  border-radius: 12px;
  color: var(--t-sub);
  text-decoration: none;
  font-size: 12px; font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease, background-color .2s ease;
}
.term-nav__btn svg { width: 24px; height: 24px; fill: currentColor; }
.term-nav__btn.is-active { color: var(--t-blue); background: rgba(0, 183, 255, .1); }
.term-nav__btn.is-active::before {
  content: ''; position: absolute; top: -7px; left: 30%; right: 30%; height: 2px;
  background: var(--t-blue); box-shadow: 0 0 10px var(--t-blue); border-radius: 2px;
}
.term-nav__btn:focus-visible { outline: 2px solid var(--t-blue); outline-offset: -2px; }
.term-nav__badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--t-green); color: #002414;
  font-size: 11px; font-style: normal; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 10px rgba(0, 220, 132, .7);
}
.term-nav__badge[hidden] { display: none; }

/* ----- 카드 ----- */
.card {
  position: relative;
  padding: 16px;
  border: 1px solid var(--t-line);
  border-radius: 16px;
  background: var(--t-panel);
  box-shadow: inset 0 0 24px rgba(0, 183, 255, .05);
}
.card--flat { padding: 4px 2px; border: 0; background: none; box-shadow: none; }
.card__label { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--t-blue); }
.card__eyebrow { margin: 0 0 4px; font-size: 12px; letter-spacing: .16em; color: var(--t-blue); }
.card__title { margin: 0 0 8px; font-size: 22px; line-height: 1.3; word-break: keep-all; }
.card--locked { text-align: center; padding: 28px 16px; }
.card--locked svg { width: 34px; height: 34px; fill: var(--t-sub); margin-bottom: 6px; }
.card--clear { border-color: rgba(0, 220, 132, .55); }
.card--ok { border-color: rgba(0, 220, 132, .6); }
.card--warn { border-color: rgba(255, 181, 71, .55); }
.card p { line-height: 1.6; margin: 0 0 10px; word-break: keep-all; overflow-wrap: anywhere; }
.card > :last-child { margin-bottom: 0; }
.muted { color: var(--t-sub); font-weight: 400; }
.small { font-size: 13px; }
.empty { margin: 8px 0; text-align: center; color: var(--t-sub); font-size: 14px; }
.ok { color: var(--t-green); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--t-blue); }

.map-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--t-sub); word-break: keep-all; }
.map-note__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--t-blue); box-shadow: 0 0 8px var(--t-blue); }

/* ----- 미션 ----- */
.mission { border-color: var(--t-line-strong); background: linear-gradient(160deg, rgba(10, 40, 72, .92), rgba(4, 16, 32, .92)); }
.mission::after {
  content: ''; position: absolute; top: -1px; left: 16px; width: 64px; height: 3px;
  background: var(--t-green); box-shadow: 0 0 12px var(--t-green); border-radius: 0 0 3px 3px;
}
.mission--pending::after { background: var(--t-warn); box-shadow: 0 0 12px var(--t-warn); }
.mission__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mission__num { font-size: 13px; font-weight: 700; letter-spacing: .18em; color: var(--t-blue); }
.mission__title { margin: 0 0 10px; font-size: 24px; line-height: 1.3; word-break: keep-all; }
.mission__meta { display: grid; gap: 6px; margin: 0 0 12px; font-size: 14px; }
.mission__meta div { display: flex; gap: 10px; }
.mission__meta dt { flex: none; width: 64px; color: var(--t-sub); }
.mission__meta dd { margin: 0; word-break: keep-all; overflow-wrap: anywhere; }
.mission__brief { font-size: 16px; }
.mission__steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; line-height: 1.5; }
.mission__steps li::marker { color: var(--t-blue); font-weight: 700; }
.unset { font-style: normal; color: var(--t-warn); }

.status { flex: none; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.status--active { color: #002414; background: var(--t-green); }
.status--pending { color: #1a1000; background: var(--t-warn); }
.status--done { color: var(--t-green); border: 1px solid var(--t-green); }

.clues { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.clue { display: grid; gap: 2px; padding: 10px 12px; border-left: 3px solid var(--t-violet); background: rgba(111, 54, 255, .12); border-radius: 8px; }
.clue span { color: var(--t-sub); font-size: 14px; }
.chip-items { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-item {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--t-line-strong); border-radius: 999px; color: var(--t-text); text-decoration: none; font-size: 14px;
}
.chip-item svg { width: 18px; height: 18px; fill: var(--t-blue); }

.hints { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.hints li { padding: 10px 12px; border: 1px dashed rgba(255, 181, 71, .5); border-radius: 10px; font-size: 15px; line-height: 1.5; }
.hint__n { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--t-warn); }

.card--action { border-color: rgba(0, 220, 132, .45); }
.fallback-links { margin: 12px 0 0; font-size: 14px; color: var(--t-sub); }
.fallback-links a { font-weight: 700; }

/* ----- 버튼 ----- */
.btn-term {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 14px;
  font-size: 17px; font-weight: 700; color: #fff; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: transform .12s ease, opacity .2s ease, background-color .2s ease;
}
.btn-term + .btn-term { margin-top: 10px; }
.btn-term:active { transform: scale(.98); }
.btn-term:disabled { opacity: .45; cursor: default; }
.btn-term:focus-visible { outline: 2px solid var(--t-blue); outline-offset: 3px; }
.btn-term--primary { background: linear-gradient(135deg, var(--t-blue), var(--t-blue-2)); box-shadow: 0 6px 22px rgba(0, 183, 255, .35); }
.btn-term--ghost { background: rgba(0, 10, 20, .5); border-color: var(--t-line-strong); color: var(--t-text); }
.btn-term--collect { background: linear-gradient(135deg, var(--t-green), #00a86a); color: #00180d; box-shadow: 0 6px 22px rgba(0, 220, 132, .4); }
.btn-term--collect:disabled { background: rgba(255, 255, 255, .1); color: var(--t-sub); box-shadow: none; }

/* 길게 눌러 확인 */
.hold {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: 64px; padding: 8px 16px;
  border: 1px solid rgba(0, 220, 132, .7); border-radius: 14px;
  background: rgba(0, 220, 132, .1); color: var(--t-text);
  font-weight: 700; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hold + .btn-term { margin-top: 10px; }
.hold__fill { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 220, 132, .55), rgba(0, 220, 132, .85)); transform: scaleX(0); transform-origin: 0 50%; }
.hold__label, .hold__sub { position: relative; }
.hold__label { font-size: 17px; }
.hold__sub { font-size: 12px; color: var(--t-sub); font-weight: 400; }
.hold.is-holding .hold__sub { color: #00180d; }

/* 정답 입력 */
.answer { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.answer .btn-term { width: auto; margin: 0; }
.answer__input {
  min-width: 0; min-height: 54px; padding: 0 14px;
  border: 1px solid var(--t-line-strong); border-radius: 14px;
  background: rgba(0, 10, 20, .7); color: var(--t-text);
  font: inherit; font-size: 18px; letter-spacing: .06em;
}
.answer__input:focus { outline: none; border-color: var(--t-blue); box-shadow: 0 0 0 3px rgba(0, 183, 255, .25); }
.answer__msg { grid-column: 1 / -1; min-height: 1.2em; margin: 0; font-size: 14px; color: var(--t-sub); }
.answer.is-wrong { animation: shake .4s ease; }
.answer.is-wrong .answer__msg { color: var(--t-danger); }
.answer.is-wrong .answer__input { border-color: var(--t-danger); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* 작전 기록 */
.logs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.log, .log > a {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px;
  border-radius: 12px; color: var(--t-text); text-decoration: none; font-size: 15px;
}
.log { background: rgba(0, 183, 255, .06); }
.log > a { flex: 1; margin: -8px -12px; }
.log__num { flex: none; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--t-blue); }
.log__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log__time { flex: none; font-size: 12px; color: var(--t-sub); }
.log--locked { color: var(--t-sub); }
.log--locked svg { width: 16px; height: 16px; fill: var(--t-sub); flex: none; }
.log--locked .log__num { color: var(--t-sub); }
.log--active { border: 1px solid rgba(0, 220, 132, .45); }
.log__check { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--t-green); position: relative; }
.log__check::after { content: ''; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px; border: solid #00180d; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.log__pulse { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--t-green); box-shadow: 0 0 0 0 rgba(0, 220, 132, .7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(0, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 220, 132, 0); } }

/* 뒤로 */
.back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 6px;
  border-radius: 10px; color: var(--t-blue); text-decoration: none; font-weight: 700; font-size: 15px;
}
.back svg { width: 22px; height: 22px; fill: currentColor; }

/* ----- 인벤토리 ----- */
.inv-head { display: flex; justify-content: space-between; align-items: baseline; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--t-line); background: transparent; color: var(--t-sub); font-weight: 700; font-size: 14px; cursor: pointer;
}
.filter.is-on { border-color: var(--t-blue); background: rgba(0, 183, 255, .14); color: var(--t-text); }
.items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 150px; padding: 18px 10px 14px;
  border: 1px solid var(--t-line-strong); border-radius: 16px;
  background: linear-gradient(170deg, rgba(10, 40, 72, .9), rgba(4, 16, 32, .9));
  color: var(--t-text); text-decoration: none; text-align: center;
}
.item__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: rgba(0, 183, 255, .12); }
.item__icon svg { width: 36px; height: 36px; fill: var(--t-blue); }
.item__icon img { max-width: 100%; max-height: 100%; object-fit: contain; }
.item__name { font-size: 15px; font-weight: 700; line-height: 1.35; word-break: keep-all; }
.item__type { font-size: 11px; letter-spacing: .1em; color: var(--t-sub); }
.item__new { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 6px; background: var(--t-green); color: #00180d; font-size: 10px; font-weight: 700; }
.item--physical .item__icon svg { fill: var(--t-green); }
.item--clue .item__icon svg { fill: #a98bff; }
.item--ar .item__icon svg { fill: #7fe3ff; }
.item.is-used { opacity: .7; }
.item--locked { border-style: dashed; border-color: var(--t-line); background: rgba(0, 10, 20, .5); color: var(--t-sub); }
.item--locked .item__icon { background: rgba(255, 255, 255, .04); }
.item--locked .item__icon svg { fill: var(--t-sub); width: 28px; height: 28px; }
.item-detail { text-align: center; }
.item-detail .mission__meta { text-align: left; margin-top: 14px; }
.item-detail__icon { display: grid; place-items: center; width: 96px; height: 96px; margin: 4px auto 12px; border-radius: 22px; background: rgba(0, 183, 255, .12); box-shadow: 0 0 30px rgba(0, 183, 255, .25); }
.item-detail__icon svg { width: 54px; height: 54px; fill: var(--t-blue); }
.item-detail.item--physical .item-detail__icon svg { fill: var(--t-green); }
.item-detail__icon img { max-width: 80%; max-height: 80%; }
.cipher { padding: 12px; border-radius: 10px; background: rgba(111, 54, 255, .14); font-size: 18px; letter-spacing: .12em; text-align: center; }
.use-result { color: var(--t-green); }
.item-actions { margin-top: 14px; }

/* ----- 통신 ----- */
.comms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comm {
  display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 14px;
  border: 1px solid var(--t-line); border-radius: 14px; background: var(--t-panel);
  color: var(--t-text); text-decoration: none;
}
.comm.is-new { border-color: rgba(0, 220, 132, .6); box-shadow: 0 0 18px rgba(0, 220, 132, .15); }
.comm__icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: rgba(0, 183, 255, .14); }
.comm__icon svg { width: 24px; height: 24px; fill: var(--t-blue); }
.comm__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.comm__title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm__meta { font-size: 12px; color: var(--t-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm__heard { flex: none; font-size: 12px; color: var(--t-sub); }
.badge-new { flex: none; padding: 2px 7px; border-radius: 6px; background: var(--t-green); color: #00180d; font-size: 11px; font-weight: 700; }
.comm-actions { margin: 14px 0 18px; }
.transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.transcript li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; font-size: 15px; line-height: 1.5; word-break: keep-all; }
.transcript__t { color: var(--t-blue); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 2px; }

/* ----- 스캐너 ----- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--t-line); border-radius: 14px; background: rgba(0, 10, 20, .6); }
.seg__btn { display: grid; place-items: center; min-height: 44px; border-radius: 10px; color: var(--t-sub); text-decoration: none; font-weight: 700; font-size: 14px; }
.seg__btn.is-on { background: rgba(0, 183, 255, .18); color: var(--t-text); box-shadow: inset 0 0 0 1px var(--t-line-strong); }
.targets { display: flex; gap: 6px; flex-wrap: wrap; }
.target {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--t-line); border-radius: 10px; background: transparent; color: var(--t-sub); font-size: 13px; font-weight: 700; cursor: pointer;
}
.target.is-on { border-color: var(--t-blue); color: var(--t-text); background: rgba(0, 183, 255, .12); }
.tag-test { padding: 1px 6px; border-radius: 4px; background: var(--t-warn); color: #1a1000; font-size: 10px; letter-spacing: .08em; }

.scan-stage {
  position: relative;
  overflow: hidden;
  height: min(46vh, 460px);
  min-height: 260px;
  border: 1px solid var(--t-line-strong);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(0, 183, 255, .12), rgba(0, 10, 20, .95) 70%);
}
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-reticle { position: absolute; inset: 14% 10%; pointer-events: none; transition: opacity .3s ease; }
.scan-reticle--square { inset: auto; left: 50%; top: 50%; width: 62%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.scan-reticle i { position: absolute; width: 28px; height: 28px; border: 3px solid var(--t-blue); filter: drop-shadow(0 0 6px var(--t-blue)); }
.scan-reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-reticle i:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-reticle i:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-stage[data-status="scanning"] .scan-reticle { animation: reticle 1.6s ease-in-out infinite; }
.scan-stage[data-status="tracking"] .scan-reticle { opacity: 0; }
@keyframes reticle { 50% { opacity: .45; } }
.scan-status {
  position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(0, 10, 20, .75); font-size: 14px; line-height: 1.45; text-align: center; word-break: keep-all;
}
.scan-stage[data-status="tracking"] .scan-status { color: #00180d; background: var(--t-green); font-weight: 700; }
.scan-stage[data-status="error"] .scan-status { color: #fff; background: rgba(255, 77, 109, .85); }
.scan-actions { display: grid; gap: 10px; }
.scan-actions .btn-term + .btn-term { margin-top: 0; }
.scan-actions [hidden] { display: none; }
.scan-help { padding: 14px; border: 1px dashed rgba(255, 181, 71, .55); border-radius: 14px; }
.tips { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--t-sub); }
.fallback-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fallback-row .btn-term + .btn-term { margin-top: 0; }
.code-value { padding: 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }

/* AR 오버레이: 종이 지도 좌표계 (CSS matrix3d 로 실제 지도 위치에 맞춤) */
.ar-overlay { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.ar-overlay[hidden] { display: none; }
.ar-frame { position: absolute; inset: 0; border: 14px solid rgba(0, 220, 132, .85); box-shadow: 0 0 60px rgba(0, 220, 132, .8), inset 0 0 60px rgba(0, 220, 132, .5); }
.ar-label {
  position: absolute; left: 50%; top: 4%; transform: translateX(-50%);
  padding: 14px 34px; border-radius: 18px; background: rgba(0, 10, 20, .82); color: #fff;
  font-size: 56px; font-weight: 700; white-space: nowrap;
}
.ar-label b { color: #ffb547; }
.ar-character { position: absolute; transform: translate(-50%, -50%); opacity: .9; filter: drop-shadow(0 0 30px rgba(0, 183, 255, .9)); animation: ar-float 3s ease-in-out infinite; }
@keyframes ar-float { 50% { margin-top: -20px; } }
.ar-marker { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; }
.ar-marker i { width: 90px; height: 90px; border-radius: 50%; border: 10px solid #00DC84; box-shadow: 0 0 40px #00DC84; animation: ar-ping 1.4s ease-out infinite; }
.ar-marker span { position: absolute; font-size: 50px; font-weight: 700; color: #fff; text-shadow: 0 0 12px #000; }
@keyframes ar-ping { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.4); opacity: .3; } }

/* ----- 연출 ----- */
.fx {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 24px;
  background: rgba(0, 10, 20, .78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.fx.is-on { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.fx__card {
  position: relative; width: min(100%, 360px); padding: 28px 20px 18px; text-align: center;
  border: 1px solid var(--t-line-strong); border-radius: 22px;
  background: linear-gradient(160deg, rgba(10, 40, 72, .96), rgba(4, 16, 32, .96));
  box-shadow: 0 0 60px rgba(0, 183, 255, .35);
  animation: fx-in .5s cubic-bezier(.2, .8, .2, 1.2) both;
}
.fx__card--complete, .fx__card--unlock { border-color: rgba(0, 220, 132, .75); box-shadow: 0 0 70px rgba(0, 220, 132, .4); }
.fx__card--comm { border-color: rgba(111, 54, 255, .8); }
.fx__eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .2em; color: var(--t-blue); }
.fx__title { margin: 0 0 6px; font-size: 30px; font-weight: 700; letter-spacing: .06em; color: var(--t-green); text-shadow: 0 0 18px rgba(0, 220, 132, .7); word-break: keep-all; }
.fx__title--sm { font-size: 24px; color: var(--t-text); text-shadow: none; }
.fx__sub { margin: 0; color: var(--t-sub); word-break: keep-all; }
.fx__tap { margin: 16px 0 0; font-size: 12px; color: rgba(234, 246, 255, .4); }
.fx__item { display: grid; place-items: center; width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 22px; background: rgba(0, 183, 255, .14); animation: fx-spin .7s ease both; }
.fx__item svg { width: 54px; height: 54px; fill: var(--t-green); }
@keyframes fx-in { from { opacity: 0; transform: scale(.8) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fx-spin { from { transform: rotateY(90deg); } to { transform: none; } }

/* 단말기 활성화 */
.term-boot {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--t-bg);
  opacity: 0; visibility: hidden; pointer-events: none;
}
.term-boot.is-on { animation: boot 1.7s ease both; visibility: visible; }
.term-boot__eyebrow { margin: 0; font-size: 12px; letter-spacing: .26em; color: var(--t-blue); }
.term-boot__title { margin: 0; font-size: 26px; font-weight: 700; }
.term-boot__line { margin: 0; font-size: 13px; letter-spacing: .2em; color: var(--t-green); }
.term-boot__bar { width: 200px; height: 3px; border-radius: 2px; background: rgba(0, 183, 255, .2); overflow: hidden; }
.term-boot__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--t-blue), var(--t-green)); animation: boot-bar 1.2s ease both; }
@keyframes boot { 0% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes boot-bar { from { width: 0; } to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .view, .fx__card, .fx__item, .ar-character, .ar-marker i, .log__pulse { animation: none !important; }
}

@media (min-width: 700px) {
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.terminal input { -webkit-user-select: text; user-select: text; }
