:root {
  --bg: #0f1113;
  --card: #15181b;
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --accent: #c0c7cf;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.container { max-width: 680px; margin: 0 auto; padding: 20px; padding-bottom: 96px; touch-action: pan-y; }
.hero { display: grid; gap: 12px; padding: 24px 0 8px; }
.title { text-align: center; font-size: 40px; letter-spacing: -0.02em; margin: 0; }
.author-btn { height: 36px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid #24282c; background: #0d0f11; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.author-btn[aria-pressed="true"] { outline: 2px solid #2b3440; background: #121419; }

.tabs { position: fixed; bottom: 12px; left: 0; right: 0; z-index: 5; display: grid; grid-auto-flow: column; gap: 8px; justify-content: center; padding: 8px 12px; }
.tab { padding: 10px 12px; border-radius: 999px; border: 1px solid #24282c; background: #0d0f11; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.tab.active { background: #15181b; }

.panel { display: grid; gap: 8px; }
.panel[hidden] { display: none; }
.panel.active { display: grid; }
.input-row { position: relative; display: grid; grid-template-columns: 1fr; align-items: start; gap: 10px; }
.author-inline { position: absolute; top: 8px; right: 8px; display: grid; grid-auto-flow: column; gap: 8px; }
#ideaInput, #wishInput, #fantasyInput { padding-right: 120px; }
#fantasyInput { padding-bottom: 56px; }

#ideaInput, #wishInput, #fantasyInput {
  width: 100%; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid #24282c; background: #0d0f11; color: var(--ink);
  font-size: 16px; outline: none; box-shadow: var(--shadow);
}
#ideaInput::placeholder, #wishInput::placeholder, #fantasyInput::placeholder { color: var(--muted); }
.actions { position: absolute; right: 8px; bottom: 8px; display: grid; z-index: 1; }
.send-btn {
  height: 36px; padding: 0 12px; border-radius: 12px;
  border: 1px solid #24282c; background: #0d0f11; color: var(--ink);
  cursor: pointer; box-shadow: var(--shadow); font-size: 13px;
}
.send-btn:hover { background: #121419; }
.list { display: grid; gap: 12px; padding: 16px 0 40px; }
.divider { height: 1px; border: none; background: #202428; margin: 8px 0 20px; }
.subtitle { margin: 0 0 8px; font-size: 18px; color: var(--muted); }
#wishInput { font-size: 15px; padding: 12px 14px; }
#wishInput.input-error {
  border-color: #c94141;
  box-shadow: 0 0 0 2px rgba(201,65,65,0.15) inset;
}
.wishlist-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px; padding: 16px 0 24px;
}
.wish {
  display: grid; grid-template-columns: 72px 1fr; align-items: center;
  gap: 12px; padding: 10px 52px 10px 10px; border-radius: 14px; background: var(--card);
  border: 1px solid #202428; box-shadow: var(--shadow); position: relative;
}
.wish .thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #0c0e10; border: 1px solid #262a2e; }
.wish .wcontent { display: grid; gap: 6px; }
.wish .wtitle {
  color: var(--ink); text-decoration: none; font-size: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wish .wtitle:hover { text-decoration: underline; }
.wish .wurl {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wish .wdelete { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); height: 32px; width: 32px; border-radius: 10px; border: 1px solid #262a2e; background: #0c0e10; color: var(--ink); cursor: pointer; }

@media (min-width: 680px) {
  .wishlist-grid { grid-template-columns: 1fr 1fr; }
}
.card {
  display: grid; grid-template-columns: 28px 1fr 38px 44px 44px; align-items: center;
  gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--card);
  border: 1px solid #202428; box-shadow: var(--shadow); touch-action: pan-y;
}
.drag-handle { cursor: grab; user-select: none; color: var(--muted); text-align: center; font-size: 18px; }
.drag-handle:active { cursor: grabbing; }
.content { display: grid; gap: 6px; }
.text { font-size: 16px; line-height: 1.4; }
.edit-input {
  font-size: 16px; line-height: 1.4; width: 100%;
  padding: 8px 10px; border-radius: 10px; border: 1px solid #262a2e;
  background: #0c0e10; color: var(--ink); outline: none;
}
.link { color: var(--accent); text-decoration: none; font-size: 13px; word-break: break-all; }
.link:hover { text-decoration: underline; }
.author { text-align: center; font-size: 18px; cursor: pointer; }
.category, .delete {
  height: 38px; width: 38px; border-radius: 12px; border: 1px solid #262a2e;
  background: #0c0e10; color: var(--ink); font-size: 18px; cursor: pointer;
}
.category { font-size: 20px; }
.delete { font-size: 18px; }
.dialog { border: none; padding: 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0,0,0,0.4); }
.dialog button { display: block; width: 100%; text-align: left; padding: 12px 14px; background: transparent; border: none; color: var(--ink); font-size: 15px; }
.dialog button + button { border-top: 1px solid #22272b; }

@media (min-width: 680px) {
  .title { font-size: 48px; }
}

/* Wishlist author */
.wish { grid-template-columns: 72px 1fr 32px; }
.wauthor { position: absolute; right: 54px; top: 50%; transform: translateY(-50%); height: 32px; width: 32px; border-radius: 10px; border: 1px solid #262a2e; background: #0c0e10; display: grid; place-items: center; }

/* Fantasies */
.fantasy-list { display: grid; gap: 12px; padding: 12px 0 24px; }
.fantasy { display: grid; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid #202428; box-shadow: var(--shadow); }
.fmeta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.fauthor { font-size: 18px; }
.ftext { white-space: pre-wrap; line-height: 1.5; font-size: 16px; }
.ftext.truncated { display: -webkit-box; -webkit-line-clamp: 6; line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.fexpand { height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid #262a2e; background: #0c0e10; color: var(--ink); cursor: pointer; }
.factions { display: flex; gap: 8px; justify-content: flex-end; }
.fdelete { height: 32px; width: 32px; border-radius: 10px; border: 1px solid #262a2e; background: #0c0e10; color: var(--ink); cursor: pointer; }