:root {
  --bg: #081524;
  --card: #10253d;
  --card-border: #1d3c5e;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --text: #eef6ff;
  --muted: #8fb1d4;
  --danger: #f87171;
  --success: #34d399;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #123152 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 76px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(8, 21, 36, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.fish-avatar {
  font-size: 32px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}
.brand h1 { font-size: 18px; line-height: 1.2; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.icon-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
}

.container { max-width: 680px; margin: 0 auto; padding: 14px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }

.emotion-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emo-chip {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px;
  cursor: pointer;
}
.emo-chip:active { transform: scale(0.96); }

.chat-card { display: flex; flex-direction: column; height: 55vh; min-height: 360px; }
.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent-strong);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.assistant {
  align-self: flex-start;
  background: #183656;
  border: 1px solid #264d78;
  border-bottom-left-radius: 4px;
}
.bubble .meta { font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 4px; }

.chat-input-bar { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.sync-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }

input[type="text"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%;
  background: #0b1b2e;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.form-row { margin-bottom: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }

.primary-btn {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.full-btn { width: 100%; margin-top: 4px; }

.item-list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #0b1b2e;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
}
.list-item.done { opacity: 0.55; text-decoration: line-through; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 500; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent);
  margin-right: 6px;
}
.del-btn {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--danger);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
}

.kv-box { font-size: 13px; display: flex; flex-direction: column; gap: 8px; word-break: break-all; }
.kv-box code { color: var(--success); background: #071321; padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--muted); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(8, 21, 36, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 0;
  cursor: pointer;
}
.nav-btn.active { color: var(--accent); font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: rgba(16, 37, 61, 0.96);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
