/* 폰과 PC를 반반 쓴다고 해서, 탭바를 폰에서는 하단 고정 / PC에서는 상단에 둔다.
   다크 단일 테마 — 나머지 홈랩 서비스와 톤을 맞춘다. */

:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #151922;
  --panel2: #1c2029;
  --line: #232936;
  --line2: #2b313d;
  --fg: #e6e8ee;
  --muted: #8b93a7;
  --accent: #5b9dff;
  --ok: #3ddc97;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 14px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.err { color: var(--danger); font-size: 13px; }

/* ------------------------------------------------------------ 로그인 */
.gate { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.gate .card { width: min(340px, 100%); display: grid; gap: 10px; }

/* ------------------------------------------------------------ 폼 요소 */
input, select, textarea, button {
  font: inherit;
  color: var(--fg);
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 9px;
  padding: 9px 11px;
}
textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button { cursor: pointer; background: var(--accent); border-color: transparent; color: #071018; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--panel2); color: var(--fg); border-color: var(--line2); font-weight: 500; }
button.danger { color: var(--danger); }

label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 7px; color: var(--fg); }
label.check input { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 10px 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

/* ------------------------------------------------------------ 탭 */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 2px;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
#tabs button {
  flex: 1; background: none; border: none; color: var(--muted); font-weight: 500;
  display: grid; gap: 2px; justify-items: center; font-size: 11px; padding: 6px 2px;
}
#tabs button span { font-size: 19px; }
#tabs button.on { color: var(--accent); }
#tabs #logout { flex: 0 0 46px; }

.tab { padding: 14px 14px 86px; max-width: 900px; margin: 0 auto; }

@media (min-width: 720px) {
  #tabs {
    position: sticky; top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--line);
    justify-content: center; gap: 6px; padding: 8px;
  }
  #tabs button { flex: 0 0 auto; grid-auto-flow: column; align-items: center; font-size: 14px; padding: 8px 16px; border-radius: 9px; }
  #tabs button span { font-size: 15px; }
  #tabs button.on { background: var(--panel2); }
  .tab { padding: 18px 18px 40px; }
}

/* ------------------------------------------------------------ Drop */
.dropzone {
  border: 2px dashed var(--line2); border-radius: 14px;
  padding: 26px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone p { margin: 3px 0; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #12213a; }
.dropzone.busy { border-color: var(--warn); }

.list { display: grid; gap: 8px; }

.item {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; display: grid; gap: 6px;
}
.item .top { display: flex; gap: 9px; align-items: baseline; }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.item .body { font-family: var(--mono); font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.item .acts button, .item .acts a {
  font-size: 12px; padding: 5px 9px; border-radius: 7px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--fg);
  text-decoration: none; font-weight: 500; cursor: pointer;
}
.item.burn { border-color: #4a3a1c; }

.qr { background: #fff; padding: 8px; border-radius: 9px; width: 148px; height: 148px; }
.qr svg { width: 100%; height: 100%; display: block; }

.linkline { display: flex; gap: 8px; align-items: center; }
.linkline code {
  background: var(--panel2); padding: 6px 9px; border-radius: 7px;
  font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; flex: 1;
}

/* ------------------------------------------------------------ Hook */
.bin { cursor: pointer; }
.bin.on { border-color: var(--accent); }
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 20px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--muted);
}
.badge.m-GET { color: var(--ok); }
.badge.m-POST { color: var(--accent); }
.badge.m-DELETE { color: var(--danger); }
.badge.m-PUT, .badge.m-PATCH { color: var(--warn); }

.req pre {
  margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px; font-family: var(--mono); font-size: 12px;
  max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.req.fresh { animation: flash 1.4s ease-out; }
@keyframes flash { from { border-color: var(--accent); background: #16233a; } }

details summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }
.urlbox { margin-top: 10px; }

/* ------------------------------------------------------------ Home */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px; text-decoration: none; color: var(--fg); display: grid; gap: 4px;
}
.tile:hover { border-color: var(--line2); background: var(--panel2); }
.tile .ico { font-size: 22px; }
.tile .st { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.dot.up { background: var(--ok); }

.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 12px; margin-bottom: 14px; }
.health div { display: grid; gap: 2px; }
.health b { font-size: 19px; font-weight: 600; }
.health span { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------ 토스트 */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 10px 16px; font-size: 14px; box-shadow: 0 10px 30px #0008;
  max-width: 90vw; text-align: center;
}
.toast.bad { border-color: var(--danger); color: var(--danger); }
@media (min-width: 720px) { .toast { bottom: 28px; } }
