:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --ink: #232330;
  --ink-soft: #5f5f74;
  --line: #e4e4ef;
  --accent: #5b5bd6;
  --accent-soft: #ecebfb;
  --danger: #b3403a;
  --pin: #b98a1f;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Google Sans", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); display: inline-block; }
.brand h1 { font-family: "EB Garamond", Georgia, serif; font-weight: 600; font-size: 24px; letter-spacing: 0.01em; }
.brand h1 em { font-style: italic; color: var(--accent); }
.top-actions { display: flex; gap: 8px; }

/* Icon buttons + tooltips */
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 30;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.top-actions [data-tip]::after { left: auto; right: 0; transform: translateY(4px); }
.top-actions [data-tip]:hover::after, .top-actions [data-tip]:focus-visible::after { transform: translateY(0); }

/* Idea form */
.idea-form {
  margin: 28px 0 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(35, 35, 48, 0.04);
}
.idea-form input[type="text"], .idea-form textarea, .idea-form select, .search-box input {
  font-family: inherit;
  font-size: 15.5px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  width: 100%;
}
.idea-form input[type="text"] { font-size: 17px; font-weight: 500; }
.idea-form textarea { resize: vertical; min-height: 44px; }
.idea-form :is(input, textarea, select):focus-visible, .search-box input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
  background: var(--card);
}
.form-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.form-row select { width: auto; min-width: 140px; }
.form-buttons { display: flex; gap: 8px; margin-left: auto; }
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #4a4ac2; }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-soft); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Toolbar: tabs + search */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab.add-list { border-style: dashed; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-box { position: relative; flex: 1 1 200px; max-width: 260px; }
.search-box svg { width: 16px; height: 16px; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.search-box input { padding-left: 34px; background: var(--card); }

/* Cards */
.cards { display: grid; gap: 12px; padding-bottom: 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(35, 35, 48, 0.04);
}
.card.pinned { border-color: #e5d5a1; background: #fffdf4; }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-size: 16.5px; font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.card-title .pin-flag { color: var(--pin); font-size: 12px; font-weight: 500; margin-left: 8px; letter-spacing: 0.04em; }
.card-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.card-actions .icon-btn { width: 32px; height: 32px; border-radius: 8px; border-color: transparent; }
.card-actions .icon-btn svg { width: 15px; height: 15px; }
.card-actions .icon-btn:hover { border-color: var(--accent); }
.card-actions .icon-btn.danger:hover { background: #fbecea; color: var(--danger); border-color: var(--danger); }
.card-actions .icon-btn.confirming { background: var(--danger); color: #fff; border-color: var(--danger); width: auto; padding: 0 10px; font-size: 13px; font-weight: 500; }
.card-note { color: var(--ink-soft); font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-meta { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 10px; margin-top: 2px; }
.card-meta .list-chip { background: var(--accent-soft); color: var(--accent); font-weight: 500; padding: 1px 9px; border-radius: 999px; }

/* Empty state */
.empty {
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--ink-soft);
}
.empty h2 { font-family: "EB Garamond", Georgia, serif; font-weight: 600; font-size: 24px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 15px; }

.storage-note { font-size: 13.5px; color: var(--ink-soft); text-align: center; margin: 28px auto 40px; max-width: 520px; }
.storage-note strong { font-weight: 500; color: var(--ink); }

.foot { border-top: 1px solid var(--line); padding: 24px 0 36px; text-align: center; font-size: 13.5px; color: var(--ink-soft); }
.foot a { color: var(--accent); text-decoration: none; font-weight: 500; }
.foot a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .brand h1 { font-size: 20px; }
  .search-box { max-width: none; }
  [data-tip]::after { display: none; } /* no hover on touch; aria-labels still cover it */
}
