:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --ink: #2a342d;
  --muted: #6f7f74;
  --muted-light: #a0b09a;
  --card: #ffffff;
  --border: rgba(76, 145, 104, 0.18);
  --border-focus: rgba(76, 145, 104, 0.45);
  --accent: #4e8e69;
  --accent-to: #76be92;
  --danger: #b05d65;
  --shadow-card: 0 4px 28px rgba(46, 61, 52, 0.09), 0 1px 4px rgba(46, 61, 52, 0.05);
  --shadow-focus: 0 6px 36px rgba(78, 142, 105, 0.16), 0 1px 4px rgba(46, 61, 52, 0.05);
  --radius-card: 20px;
  --radius-btn: 12px;
  --font: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% 10%, rgba(118, 190, 146, 0.13) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(79, 120, 168, 0.07) 0%, transparent 50%),
    var(--bg);
  min-height: 100svh;
}

button, textarea, input { font: inherit; }
button { color: inherit; cursor: pointer; }

/* ── Shell ── */
.home-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: 36px 20px 80px;
}

/* ── Header ── */
.home-header {
  display: flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  margin-bottom: 72px;
  width: 100%;
}

.user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.username-display {
  font-size: 0.88rem;
  color: var(--muted);
}

.logout-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  padding: 5px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.brand-logo {
  width: 30px;
  height: 30px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* ── Hero ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  gap: 10px;
}

.hero-title {
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.hero-sub {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.6;
}

/* ── Input card ── */
.input-card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input-card:focus-within {
  box-shadow: var(--shadow-focus);
  border-color: var(--border-focus);
}

.idea-input {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 22px 24px 10px;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  line-height: 1.65;
}

.idea-input::placeholder {
  color: var(--muted-light);
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 14px 24px;
}

.char-count {
  font-size: 12px;
  color: var(--muted-light);
  letter-spacing: 0.02em;
}

/* ── Diverge button ── */
.diverge-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-to) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: opacity 0.15s, transform 0.12s;
  white-space: nowrap;
}

.diverge-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.diverge-btn:hover { opacity: 0.88; }
.diverge-btn:active { transform: scale(0.97); }
.diverge-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error & hint ── */
.error-text {
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.hint-text {
  font-size: 12px;
  color: var(--muted-light);
  text-align: center;
  margin-top: 2px;
}

.hint-text kbd {
  display: inline-block;
  background: rgba(76, 145, 104, 0.08);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 11px;
  color: var(--muted);
}

/* ── Recent section ── */
.recent-section {
  width: 100%;
  max-width: 600px;
  margin-top: 56px;
}

.recent-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px 13px 18px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.recent-item:hover {
  border-color: var(--border-focus);
  box-shadow: 0 2px 14px rgba(78, 142, 105, 0.09);
}

.recent-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item-time {
  font-size: 12px;
  color: var(--muted-light);
  flex-shrink: 0;
}

.recent-item-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-light);
  transition: color 0.15s, background 0.15s;
}

.recent-item-delete:hover {
  color: var(--danger);
  background: rgba(176, 93, 101, 0.08);
}

.recent-item-delete svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}
