:root {
  --bg: #0b1f2e;
  --bg2: #0f2c40;
  --card: #11354c;
  --card-border: #1d4d6b;
  --accent: #2b9fd6;
  --accent-strong: #0f5c8c;
  --text: #eaf4fb;
  --muted: #9fbed2;
  --ok: #3ec07a;
  --warn: #e6b33e;
  --err: #e06a6a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Sukhumvit Set", "Noto Sans Thai", Tahoma, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px 48px; }

header.app-header {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 18px;
}
header.app-header img { width: 56px; height: 56px; border-radius: 14px; }
header.app-header h1 { font-size: 1.35rem; margin: 0; }
header.app-header .sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}

.card h2 { font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

.meta-row { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.meta-row b { color: var(--text); font-weight: 600; }

.bulletin-line {
  display: flex; gap: 10px; padding: 9px 0;
  border-top: 1px dashed rgba(255,255,255,.08);
}
.bulletin-line:first-of-type { border-top: none; }
.bulletin-line .tag {
  flex: 0 0 auto; font-size: .72rem; font-weight: 700; letter-spacing: .5px;
  background: var(--accent-strong); color: #fff; padding: 2px 8px; border-radius: 6px; height: fit-content;
}
.bulletin-line .txt { white-space: pre-wrap; word-break: break-word; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: .98rem; font-weight: 600; padding: 12px 16px; margin: 6px 6px 0 0;
  color: #fff; background: var(--accent); transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #2a4d65; }
.btn.danger { background: #8c3a3a; }

.status-pill {
  display: inline-block; font-size: .8rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: #1d4d6b; color: var(--text);
}
.status-pill.ok { background: rgba(62,192,122,.18); color: var(--ok); }
.status-pill.warn { background: rgba(230,179,62,.18); color: var(--warn); }
.status-pill.err { background: rgba(224,106,106,.18); color: var(--err); }

.sub-count { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.sub-count b { color: var(--text); font-weight: 700; }

.note {
  font-size: .85rem; color: var(--muted); margin-top: 10px;
  background: rgba(255,255,255,.03); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px;
}
.note.hidden { display: none; }

.history-item { padding: 11px 0; border-top: 1px solid rgba(255,255,255,.07); }
.history-item:first-child { border-top: none; }
.history-item .when { color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.history-item .line { font-size: .92rem; }

footer.notice {
  margin-top: 22px; font-size: .82rem; color: var(--muted);
  border-top: 1px solid var(--card-border); padding-top: 16px;
}
footer.notice strong { color: var(--text); }

.fineprint { font-size: .74rem; color: #6f93a8; margin-top: 10px; }
a { color: var(--accent); }

/* ---- iOS install guide ---- */
.hidden { display: none !important; }

.ios-guide { border-left: 4px solid var(--accent); }
.ios-guide .ios-intro { margin: 0 0 12px; font-size: .92rem; }
.ios-steps { margin: 0 0 6px; padding-left: 22px; }
.ios-steps li { padding: 4px 0; font-size: .92rem; }
.ios-ico { font-size: 1.05em; }
.ios-note { margin-top: 12px; }

/* ---- diagnostics ---- */
#diag > summary {
  cursor: pointer; font-size: 1.05rem; font-weight: 600;
  list-style: none; user-select: none;
}
#diag > summary::-webkit-details-marker { display: none; }
#diag > summary::before { content: "▸ "; color: var(--muted); }
#diag[open] > summary::before { content: "▾ "; }

.diag-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
  margin-top: 12px; font-size: .85rem;
}
.diag-k { color: var(--muted); }
.diag-v { color: var(--text); font-weight: 600; word-break: break-all; }
.diag-next {
  margin-top: 12px; font-size: .85rem; color: var(--muted);
  background: rgba(255,255,255,.03); border-left: 3px solid var(--accent);
  padding: 8px 12px; border-radius: 6px;
}
