/* TouchTrans PoC 스타일 */
:root {
  --bg: #0f1115;
  --card: #171a21;
  --line: #262b36;
  --fg: #e6e9ef;
  --dim: #98a2b3;
  --accent: #4f9cf9;
  --ok: #3ddc84;
  --warn: #f5a524;
  --err: #f2555a;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.55 "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
}
code { font-family: Consolas, monospace; background: #0b0d11; padding: 1px 5px; border-radius: 3px; }

.tt-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: #12151b;
  position: sticky; top: 0; z-index: 10;
}
.tt-head h1 { font-size: 17px; margin: 0; letter-spacing: .2px; }
.tt-tag {
  font-size: 11px; background: var(--accent); color: #06101f;
  padding: 1px 7px; border-radius: 10px; vertical-align: 2px; font-weight: 700;
}
/* 오른쪽 정렬은 제목이 민다. 알약 버튼이 없는 화면(app-poc)에서도 상태는 오른쪽에 붙는다. */
.tt-head h1 { margin-right: auto; }
/* 상태 알약과 나란히 서지만 눌러야 하는 것이라 색을 달리한다. */
.tt-pill {
  font-size: 13px; padding: 4px 12px; border-radius: 14px; text-decoration: none;
  background: rgba(91,140,255,.16); color: #9fbcff; border: 1px solid rgba(91,140,255,.42);
  white-space: nowrap; transition: background .12s, color .12s;
}
.tt-pill:hover { background: rgba(91,140,255,.3); color: #d7e4ff; }
.tt-status {
  font-size: 13px; padding: 4px 12px;
  border-radius: 14px; background: #20242e; color: var(--dim);
}
.tt-status.live { background: rgba(61,220,132,.15); color: var(--ok); }
.tt-status.wait { background: rgba(245,165,36,.15); color: var(--warn); }
.tt-status.err  { background: rgba(242,85,90,.15); color: var(--err); }

.tt-alert {
  margin: 14px 22px; padding: 10px 14px; border-radius: 6px;
  background: rgba(242,85,90,.12); border: 1px solid rgba(242,85,90,.4); color: #ffb4b6;
}

.tt-wrap {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px; padding: 16px 22px 40px;
}
.tt-span { grid-column: 1 / -1; }

.tt-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px;
}
.tt-card h2 {
  font-size: 13px; margin: 0 0 12px; color: var(--accent);
  text-transform: uppercase; letter-spacing: .8px;
}
.tt-card h3 { font-size: 12px; margin: 0 0 6px; color: var(--dim); font-weight: 600; }

label { display: block; margin-bottom: 10px; font-size: 12.5px; color: var(--dim); }
select, input[type=number] {
  width: 100%; margin-top: 4px; padding: 7px 9px;
  background: #0d1015; color: var(--fg);
  border: 1px solid var(--line); border-radius: 5px; font-size: 13px;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }
.tt-hint { color: #6b7484; font-size: 11px; font-weight: 400; }

.tt-check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.tt-check input { margin-top: 3px; accent-color: var(--accent); }
.tt-check span { color: var(--fg); font-size: 12.5px; }
.tt-check em { color: #6b7484; font-style: normal; font-size: 11px; }

.tt-actions { display: flex; gap: 8px; margin-top: 14px; }
.tt-btn {
  flex: 1; padding: 9px 14px; border: 0; border-radius: 6px;
  background: var(--accent); color: #06101f; font-weight: 700; font-size: 13px; cursor: pointer;
}
.tt-btn:disabled { opacity: .4; cursor: default; }
.tt-btn-stop { background: var(--err); color: #fff; }
.tt-btn-sub { background: #2a303c; color: var(--fg); font-weight: 600; width: 100%; }

.tt-diagram {
  margin: 0 0 10px; padding: 12px 14px; background: #0b0d11;
  border: 1px solid var(--line); border-radius: 6px;
  font: 12px/1.8 Consolas, monospace; color: #b9c2d0; overflow-x: auto;
}
.tt-note { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
.tt-note b { color: #cfd6e2; }

.tt-meter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: var(--dim); }
.tt-meter-row span { min-width: 120px; }
.tt-meter { flex: 1; height: 9px; background: #0b0d11; border-radius: 5px; overflow: hidden; margin: 6px 0; }
.tt-meter-fill { height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.tt-meter-fill.hot { background: var(--err); }
.tt-holdstate { font-size: 12px; color: var(--dim); margin-top: 8px; }
.tt-holdstate b { color: var(--warn); }

.tt-metrics { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tt-metrics th {
  text-align: left; font-weight: 500; color: var(--dim);
  padding: 5px 0; border-bottom: 1px solid #1e222b;
}
.tt-metrics td {
  text-align: right; padding: 5px 0; border-bottom: 1px solid #1e222b;
  font-family: Consolas, monospace;
}
.tt-metrics tr.tt-hi th { color: var(--fg); font-weight: 700; }
.tt-metrics tr.tt-hi td { color: var(--ok); font-weight: 700; }

.tt-cap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tt-cap {
  height: 110px; overflow-y: auto; padding: 9px 11px;
  background: #0b0d11; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.tt-cap-out { border-color: #2c4f7c; color: #cfe2ff; }

.tt-diag { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.tt-badge {
  font-size: 10px; background: var(--warn); color: #2a1c00;
  padding: 1px 6px; border-radius: 8px; font-weight: 700;
}

.tt-log {
  height: 190px; overflow-y: auto; padding: 9px 11px;
  background: #0b0d11; border: 1px solid var(--line); border-radius: 6px;
  font: 11.5px/1.65 Consolas, monospace; color: #9aa4b2;
}
.log-line.ok   { color: var(--ok); }
.log-line.warn { color: var(--warn); }
.log-line.err  { color: var(--err); }

@media (max-width: 760px) {
  .tt-cap-grid, .tt-diag { grid-template-columns: 1fr; }
}

/* 좁은 폭 대응 — Tauri 창 기본값이 460px 이다.
   ui_shots 460px 캡처에서 배선도가 잘려 읽을 수 없었다(2026-08-08).
   가로 스크롤이 있어도 사람은 스크롤하지 않는다. 글자를 줄여 한 화면에 넣는다. */
@media (max-width: 560px) {
  .tt-wrap { padding: 12px 12px 32px; gap: 10px; }
  .tt-card { padding: 12px 12px; }
  .tt-diagram { font-size: 9.5px; line-height: 1.7; padding: 9px 10px; letter-spacing: -.2px; }
  .tt-head { padding: 11px 14px; }
  .tt-head h1 { font-size: 15px; }
  .tt-metrics { font-size: 11.5px; }
  .tt-meter-row span { min-width: 92px; font-size: 11px; }
  .tt-cap { height: 84px; font-size: 12px; }
}

/* ───────── 첫 실행 인증 화면 (tt-onboard.js) ─────────
   설치 직후와 인증이 풀린 상황에서 화면 전체를 덮는다. 막힌 상태에서는
   화면이 그 이야기만 해야 사용자가 원인을 찾는다. */
body.ct-onb-open { overflow: hidden; }

.ct-onb {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 24, .88);
  padding: 20px;
}
.ct-onb[hidden] { display: none; }

.ct-onb-box {
  width: 100%; max-width: 440px;
  background: #161f3d; border: 1px solid #2a3763; border-radius: 14px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.ct-onb-box h2 { margin: 0 0 6px; font-size: 20px; }
.ct-onb-sub { margin: 0 0 20px; color: #9aa7c7; font-size: 14px; }

.ct-onb-box label {
  display: block; margin: 14px 0 6px;
  font-size: 12.5px; color: #9aa7c7;
}
.ct-onb-box input[type=text] {
  width: 100%; padding: 12px 14px;
  border: 1px solid #2a3763; border-radius: 10px;
  background: #0d1428; color: #e9edf7;
  font-size: 16px; letter-spacing: .5px;
}
.ct-onb-box input[type=text]:focus { outline: 2px solid #5b8cff; outline-offset: 0; }
#ctOnbKey { font-family: Consolas, "D2Coding", monospace; text-transform: uppercase; }

.ct-onb-hint { margin: 6px 0 0; font-size: 12px; color: #7c88a8; }

.ct-onb-msg {
  margin-top: 16px; padding: 11px 13px; border-radius: 9px; font-size: 13.5px;
  background: #1b2444; border: 1px solid #2a3763; color: #cfd8ef;
}
.ct-onb-msg[hidden] { display: none; }
.ct-onb-err { background: #3a1520; border-color: #8a3350; color: #ffc4d2; }
.ct-onb-ok  { background: #10301f; border-color: #2c7a55; color: #b6f2d6; }

.ct-onb-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.ct-onb-foot { margin: 16px 0 0; font-size: 12px; color: #7c88a8; }

@media (max-width: 480px) {
  .ct-onb-box { padding: 22px 18px 18px; }
}

/* ───────── 사용자 화면 (app.php) ─────────
   처음 보이는 것은 언어 · 오디오 연결 · 시작 버튼뿐이다. 나머지는 접어 둔다. */

.tt-simple .tt-wrap { max-width: 720px; margin: 0 auto; }

/* 나란히 두 칸. 좁아지면 세로로 쌓인다.
   .tt-lang2 는 가운데 ⇄ 기호가 들어가는 3칸이고, .tt-two 는 그냥 2칸이다.
   처음에 둘을 같은 클래스로 썼더니 라벨 하나가 폭 0 인 auto 칸에 들어가
   글자가 세로로 한 자씩 쪼개졌다(스크린샷으로 잡았다). */
.tt-lang2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.tt-two   { display: grid; grid-template-columns: 1fr 1fr;      gap: 12px; align-items: end; }
.tt-lang2 > label, .tt-two > label { margin: 0; min-width: 0; }
.tt-lang2 select, .tt-two select { width: 100%; }
/* ⇄ 는 진짜 버튼이다(누르면 두 언어가 바뀐다).
   기호만 있고 테두리가 없으면 눌러도 되는지 알 수 없으므로 hover·focus 에서 드러낸다. */
.tt-lang-swap {
  margin-bottom: 6px; padding: 6px 10px; color: #7c88a8; font-size: 18px; line-height: 1;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.tt-lang-swap:hover { color: #dbe4ff; background: rgba(124,136,168,.16); border-color: rgba(124,136,168,.45); }
.tt-lang-swap:active { transform: translateY(1px); }
.tt-lang-swap:focus-visible { outline: 2px solid var(--acc, #5b8cff); outline-offset: 2px; }
@media (max-width: 560px) {
  .tt-lang2, .tt-two { grid-template-columns: 1fr; }
  /* 세로로 쌓이면 두 칸 사이에 그대로 둔다. 숨기면 좁은 화면에서만 기능이 사라진다. */
  .tt-lang-swap { justify-self: center; margin: -4px 0 2px; }
}

/* 제목 줄 오른쪽의 작은 버튼.
   처음에 float:right 로 붙였더니 .tt-btn 이 display:block; width:100% 라
   폭을 전부 먹었고, 바로 아래 그리드(.tt-two)는 BFC 라서 그 float 를 피해
   **폭 0 으로 눌렸다** — 라벨 글자가 세로로 한 자씩 쪼개진 원인이다.
   float 대신 제목 줄 자체를 flex 로 만든다. */
.tt-card h2.tt-h2row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tt-btn-tiny { width: auto; font-size: 12px; padding: 5px 11px; flex: 0 0 auto; }

.tt-levels { margin: 16px 0 4px; }

/* 통화 앱에 무엇을 넣어야 하는지 — 이 화면에서 가장 중요한 안내다. */
.tt-howto {
  margin-top: 16px; padding: 13px 15px;
  background: #12203a; border: 1px solid #2a4a7a; border-left: 3px solid #5b8cff;
  border-radius: 9px; font-size: 13.5px;
}
.tt-howto b { display: block; margin-bottom: 8px; color: #cfe0ff; font-weight: 600; }
.tt-howto-row { color: #9aa7c7; margin: 4px 0; }
.tt-howto code {
  background: #0d1428; border: 1px solid #2a3763; border-radius: 5px;
  padding: 2px 7px; color: #37d6a8; font-size: 13px;
}

/* 시작 버튼은 크게. 사용자가 이 화면에서 누를 것은 사실상 이것 하나다. */
.tt-go { text-align: center; }
.tt-btn-big { font-size: 16px; padding: 14px 34px; }
.tt-golead { margin-top: 12px; font-size: 12.5px; color: #7c88a8; }

.tt-cap-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .tt-cap-2 { grid-template-columns: 1fr; } }

/* 접는 영역 */
.tt-adv, .tt-adv-block { border-radius: 10px; }
.tt-adv > summary, .tt-adv-block > summary {
  cursor: pointer; color: #9aa7c7; font-size: 13.5px;
  padding: 10px 2px; list-style: none; user-select: none;
}
.tt-adv > summary::-webkit-details-marker,
.tt-adv-block > summary::-webkit-details-marker { display: none; }
.tt-adv > summary::before, .tt-adv-block > summary::before { content: "▸ "; color: #5b8cff; }
.tt-adv[open] > summary::before, .tt-adv-block[open] > summary::before { content: "▾ "; }
.tt-adv > summary:hover, .tt-adv-block > summary:hover { color: #e9edf7; }
.tt-adv { margin-top: 14px; border-top: 1px solid #26325c; }
.tt-adv-block > summary { font-size: 14px; }
.tt-adv-inner > h3 {
  margin: 24px 0 8px; font-size: 13px; color: #9aa7c7;
  text-transform: none; letter-spacing: .2px;
  border-top: 1px solid #26325c; padding-top: 16px;
}
.tt-adv-inner > h3:first-child { border-top: 0; margin-top: 8px; padding-top: 0; }

/* 첫 실행 — Gemini 키 단계 */
.ct-onb-steps { margin: 10px 0 0; padding-left: 20px; color: #9aa7c7; font-size: 12.5px; }
.ct-onb-steps li { margin: 5px 0; }
.ct-onb-steps a { color: #5b8cff; }
.ct-onb-warn {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 12px;
  background: #2a2210; border-left: 3px solid #ffcc66; color: #ffe6ad;
}
