/* ============================================================
   [Pages 侧] styles.css — 写卡控制台（登录门 + 单屏布局 + 仅 FeliCa）
   布局铁律：整页不出现浏览器滚动条 —— html/body 锁高，shell 用 grid 三分，
   只有 .side / .panel / #writeLog 内部滚动。
   ============================================================ */
:root {
  --bg: #0f1720; --card: #16202e; --border: #243244;
  --text: #d7e2ee; --muted: #7f8ea3; --accent: #3aa6ff;
  --ok: #37c978; --err: #ff5c6c; --warn: #e8b33a; --radius: 8px;
}
* { box-sizing: border-box; }

/* ⚠️ 必须放在所有组件规则之前/之后都要生效的关键一条：
   作者样式里的 `display:flex/grid` 会覆盖 UA 的 `[hidden]{display:none}`，
   导致 `el.hidden = true` 对 .gate / .shell / .panel 完全无效（登录门关不掉）。
   用 !important 强制让 hidden 属性始终优先。 */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; font-size: 13px;
}

/* ============ 登录门 ============ */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #17293c 0%, var(--bg) 70%);
}
.gate-box {
  width: 340px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px;
}
.gate-box h1 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.gate-sub { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.gate-msg { margin-top: 10px; font-size: 12px; color: var(--muted); min-height: 18px; }
.gate-msg.ok { color: var(--ok); }
.gate-msg.bad { color: var(--err); }
.gate-tip { margin: 12px 0 0; font-size: 11px; color: var(--muted); }

/* ============ 主框架：顶栏 + 主体 + 日志条 ============ */
.shell { height: 100vh; display: grid; grid-template-rows: 40px 1fr 98px; }

.topbar {
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: #121c28; border-bottom: 1px solid var(--border);
}
.brand { font-size: 14px; font-weight: 600; }
.ver {
  margin-left: 8px; font-size: 10px; font-weight: 400; color: #04121f;
  background: var(--accent); padding: 1px 7px; border-radius: 999px;
}
.sep { color: var(--border); }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4a5a6d; flex: none; }
.dot.on { background: var(--ok); }
.dot.off { background: #4a5a6d; }

.body {
  display: grid; grid-template-columns: 300px 1fr; gap: 10px;
  padding: 10px; overflow: hidden; min-height: 0;
}
.side { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.main { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 8px; }

/* ============ 卡片 / 表单 ============ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
}
.card h3 { margin: 0 0 8px; font-size: 12px; color: var(--accent); font-weight: 600; }
label { display: block; font-size: 11px; color: var(--muted); margin: 8px 0 3px; }
label.inline { display: inline-flex; align-items: center; gap: 3px; margin: 0; }

input, textarea, select {
  width: 100%; background: #0c131c; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font: inherit; font-size: 12px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: none; font-family: "Consolas", monospace; }
select { padding: 6px 4px; }
.w70 { width: 70px; flex: none; }
.w120 { width: 120px; flex: none; }
.w140 { width: 140px; flex: none; }
.w180 { width: 180px; flex: none; }
.w200 { width: 200px; flex: none; }
.hidden { display: none; }

.row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }

.btn {
  background: #1c2a3a; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #04121f; border-color: var(--accent); font-weight: 600; }
.btn.danger { background: #3a1c22; border-color: #6b2b34; color: #ffb3bb; }
.btn.danger:hover:not(:disabled) { border-color: var(--err); color: #fff; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 14px; padding: 9px; }

.kv { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; }
.kv span { color: var(--muted); }
.kv b { font-family: "Consolas", monospace; font-weight: 500; word-break: break-all; }

/* ============ 分页 ============ */
.tabs { display: flex; gap: 4px; flex: none; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-bottom: none; border-radius: 6px 6px 0 0; padding: 5px 12px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.tab.active { background: var(--card); color: var(--accent); border-color: var(--border); }
.panel {
  flex: 1; min-height: 0; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 10px;
}

/* ============ 日志 ============ */
.log {
  background: #0a1019; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; min-height: 30px; max-height: 240px; overflow-y: auto;
  margin: 8px 0; font-size: 11.5px; white-space: pre-wrap; word-break: break-word;
  color: var(--text); font-family: "Consolas", monospace;
}
.result { border-color: var(--accent); }
.hint-box {
  color: var(--muted); background: #0c131c; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; margin-top: 6px;
  font-size: 11px; font-family: inherit; max-height: 50px; overflow-y: auto;
}
.logbar { padding: 0 10px 10px; min-height: 0; }
.logbar .log { height: 100%; margin: 0; max-height: none; overflow-y: auto; }

.hint { color: var(--muted); font-size: 11.5px; }

/* 窄屏兜底：侧栏折到上方，仍保持单屏 */
@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { max-height: 40vh; }
}
