:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg2: #111827;
  --card: #1e293b;
  --card-hover: #243247;
  --border: #334155;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a55, transparent),
              radial-gradient(900px 500px at 100% 0%, #0ea5e933, transparent),
              var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 28rem;
  margin: 0 auto;
  min-height: 100%;
  padding: 0.75rem 1rem calc(1.5rem + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.35rem 0 0.15rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 12rem;
}
.brand > div { min-width: 0; }
.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  background: linear-gradient(145deg, var(--accent), #0ea5e9);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px #2563eb66;
  flex-shrink: 0;
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.brand .tagline {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-select {
  appearance: none;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  flex: 0 0 auto;
  max-width: 7.25rem;
  margin-left: auto;
}

.card {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.card h2 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--fg);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  outline: none;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3b82f633;
}
input::placeholder { color: #64748b; }

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  width: 100%;
  box-shadow: 0 6px 16px #2563eb55;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-danger {
  background: #7f1d1d55;
  color: #fecaca;
  border: 1px solid #ef444466;
}
.btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

.preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
}
.stat .label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.stat .value {
  margin-top: 0.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  word-break: break-all;
}
.stat .sub { font-size: 0.7rem; color: #64748b; margin-top: 0.15rem; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.list-head h2 { margin: 0; }
.count-pill {
  font-size: 0.72rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.25rem 0.5rem;
}

.item {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
}
.item + .item { margin-top: 0.65rem; }
.item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}
.item-name {
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}
.item-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.item-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.item-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.item-stats .chip {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}
.item-stats .chip span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.item-stats .chip strong {
  font-size: 0.9rem;
  font-weight: 800;
}

.about {
  font-size: 0.82rem;
  color: var(--muted);
}
.about p { margin: 0 0 0.5rem; }
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.25rem 0 0.5rem;
}

.ad-slot {
  min-height: 100px;
  width: 100%;
  border: 1px dashed #475569;
  border-radius: 12px;
  background: #0f172a88;
  display: block;
  overflow: hidden;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ad-slot .adsbygoogle {
  display: block;
  min-height: 90px;
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + var(--safe-b));
  transform: translateX(-50%) translateY(120%);
  background: #022c22;
  color: #bbf7d0;
  border: 1px solid #16a34a88;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  z-index: 50;
  max-width: calc(100% - 2rem);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 480px) {
  .app { padding-top: 1.25rem; }
  .brand h1 { font-size: 1.15rem; }
}


.dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 320px;
  width: calc(100% - 32px);
  background: var(--card, #1e293b);
  color: var(--fg, #f1f5f9);
  box-shadow: var(--shadow, 0 20px 50px rgba(0,0,0,.45));
}
.dialog::backdrop { background: rgba(2, 6, 23, 0.65); }
.dialog-body { margin: 0; padding: 1.1rem 1.15rem 1rem; }
.dialog-body p { margin: 0 0 1rem; font-weight: 600; line-height: 1.4; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.btn-danger {
  background: var(--danger, #ef4444);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.local-only {
  margin: 0 0 0.35rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #111;
  background: #ffcc33;
  border: 1px solid #111;
  border-radius: 8px;
  overflow-wrap: anywhere;
  min-width: 0;
}
