:root {
  --ink: #17142b;
  --muted: #5c5775;
  --brand: #6b4eff;
  --brand-ink: #2c1a8f;
  --action: #5838db;
  --coral: #ff5b4a;
  --lime: #c8f53b;
  --sky: #2fb2ff;
  --sun: #ffbf2f;
  --paper: #fbf8f3;
  --card: #ffffff;
  --line: #e4dff5;
  --ok: #10a37f;
  --warn: #e08b00;
  --crit: #ff5b4a;
  --shadow-pop: 0 4px 0 var(--ink);
  --shadow-soft: 0 12px 28px rgba(23, 20, 43, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 8%, rgba(107, 78, 255, 0.09), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(200, 245, 59, 0.18), transparent 32%),
    radial-gradient(circle at 80% 88%, rgba(47, 178, 255, 0.09), transparent 34%);
}

:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 18px 64px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--ink);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  animation: pulse 2s infinite;
}

.pulse-dot.offline {
  background: var(--coral);
  animation: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(16, 163, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0); }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

select, input[type="number"], input[type="text"], input[type="password"], textarea {
  font: inherit;
  padding: 9px 12px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 82px;
  line-height: 1.5;
  font-weight: 500;
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 14px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--action);
  color: #fff;
  box-shadow: 0 3px 0 var(--brand-ink);
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
}

.btn-danger {
  background: var(--coral);
  color: #fff;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.82rem;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--ink);
}

.security-banner {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--ink);
  background: #ffffff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--paper);
}

.pill-lime { background: var(--lime); }
.pill-brand { background: #ede9ff; color: var(--brand-ink); }
.pill-coral { background: #ffe4e0; color: #a11c10; border-color: #a11c10; }
.pill-ok { background: #dcfce7; color: #0b664b; border-color: #0b664b; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 14px;
}

.tab-btn {
  font: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--ink);
  color: var(--lime);
}

.card {
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-pop);
  margin-bottom: 16px;
}

.card h2, .card h3 {
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.compose-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.clip-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clip-card {
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clip-body {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
  position: relative;
}

.clip-body.masked {
  filter: blur(7px);
  user-select: none;
  cursor: pointer;
}

.clip-body.locked {
  font-family: inherit;
  color: var(--muted);
  background: #f5f2ff;
  border-style: dashed;
}

.ttl-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ttl-bar-fill {
  height: 100%;
  background: var(--brand);
  transition: width 0.4s linear;
}

.ttl-bar-fill.urgent {
  background: var(--coral);
}

.clip-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.preset-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.preset-btn.active {
  background: var(--brand);
  color: #fff;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.setting-box {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--paper);
  margin-bottom: 10px;
}

.pairing-code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 12px 18px;
  background: var(--lime);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  display: inline-block;
  margin-top: 8px;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--lime);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
}

.information-page {
  max-width: 46rem;
  margin: 2rem auto;
  padding: clamp(1rem, 5vw, 2.5rem);
  line-height: 1.65;
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
  .btn, .toast, .ttl-bar-fill { transition: none; }
}

@media (max-width: 640px) {
  .shell { padding: 12px 12px 56px; }
  .topbar { padding: 12px 14px; }
}
