:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-press: #1d4ed8;
  --danger: #dc2626;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --card: #1a2130;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --border: #2a3345;
    --primary: #3b82f6;
    --primary-press: #2563eb;
    --danger: #ef4444;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 上部バー */
.topbar {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-size: 1.15rem;
  margin: 0;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-email {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: 0.7rem;
  background: #f59e0b;
  color: #1f2430;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* レイアウト */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ボタン */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-press);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ログイン画面 */
.login-card {
  text-align: center;
  margin-top: 40px;
}

.login-card .btn-primary {
  margin-top: 8px;
  width: 100%;
  padding: 14px;
}

/* メモ入力 */
.note-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-input {
  width: 100%;
  resize: vertical;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.note-input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

/* メモ一覧 */
.note-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.note-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.note-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.note-del {
  flex-shrink: 0;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.note-del:hover {
  border-color: var(--danger);
}
