:root {
  --bg: #0f172a; --card: #1e293b; --line: #334155; --text: #f1f5f9; --muted: #94a3b8;
  --accent: #38bdf8; --danger: #ef4444; --ok: #22c55e; --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif; font-size: 16px; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 100px; }

header { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
header h1 { font-size: 24px; margin: 0; }
h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 24px 0 8px; }

button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--card); color: var(--text); text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); color: #0f172a; font-weight: 700; }
button.danger { background: var(--danger); color: #fff; font-weight: 700; }
button.ghost { background: transparent; color: var(--muted); }
button.block { width: 100%; padding: 14px; font-size: 17px; }
button:disabled { opacity: .5; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.card.off { opacity: .5; }
.card .row { display: flex; align-items: center; gap: 10px; }
.card .title { font-weight: 700; font-size: 17px; flex: 1; word-break: break-all; }
.card .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; }
.card .actions button { flex: 1; padding: 8px; font-size: 14px; }

.ringing { background: var(--danger); border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
  animation: pulse 1s infinite alternate; }
.ringing h3 { margin: 0 0 8px; font-size: 18px; }
.ringing .item { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.ringing .item span { flex: 1; font-weight: 600; }
.ringing button { background: #fff; color: var(--danger); font-weight: 800; }
@keyframes pulse { from { box-shadow: 0 0 0 0 #ef444488; } to { box-shadow: 0 0 0 10px #ef444400; } }

label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
input[type=checkbox] { width: auto; }
textarea { min-height: 60px; resize: vertical; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; padding: 10px 8px; font-size: 14px; border: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #0f172a; font-weight: 700; border-color: var(--accent); }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border-radius: 10px; padding: 12px; margin-top: 8px; }
.switch small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.switch input { width: 22px; height: 22px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.help { color: var(--muted); font-size: 14px; line-height: 1.6; }
.help ol { padding-left: 20px; }
.help code, .code { background: #0b1222; padding: 2px 6px; border-radius: 6px; color: var(--accent); }
.sound-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sound-row span { flex: 1; font-size: 14px; }
.sound-row .btn, .sound-row button { padding: 6px 10px; font-size: 13px; }
.fab { position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(24px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%; font-size: 32px; padding: 0;
  background: var(--accent); color: #0f172a; box-shadow: 0 6px 20px #0008; }
.warn { background: #78350f; color: #fde68a; border-radius: 10px; padding: 12px; font-size: 14px; margin-bottom: 12px; }
.warn button { margin-top: 8px; }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #000d; color: #fff;
  padding: 10px 16px; border-radius: 20px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90%; }
#toast.show { opacity: 1; }

.volume { display: flex; align-items: center; gap: 10px; padding: 4px 2px 10px; }
.volume input[type=range] { flex: 1; accent-color: #ff3b30; }
.volume b { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: 12px; font-weight: 500; color: #7dd3fc; background: rgba(56,189,248,.12);
  border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
