:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --score-high: #16a34a;
  --score-medium: #f59e0b;
  --score-low: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { color: var(--primary); }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-active span:nth-child(2) {
  opacity: 0;
}
.hamburger-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 600px) {
  .hamburger {
    display: flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 20px;
    gap: 12px;
  }
  .nav-links.nav-open {
    display: flex;
  }
  .navbar .container {
    position: relative;
  }
}

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 60px;
  text-align: center;
}
.footer p {
  color: var(--text-light);
  font-size: 0.9rem;
}
.footer a {
  color: var(--primary);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

.flash {
  padding: 12px 20px;
  border-radius: 10px;
  margin: 16px 0 0;
  font-size: 0.9rem;
}
.flash-notice {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.flash-alert {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.auth-prompt {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 8px;
}
.auth-prompt a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.auth-prompt a:hover {
  text-decoration: underline;
}

.wish-delete {
  font-size: 0.8rem;
  color: var(--score-low);
  text-decoration: none;
}
.wish-delete:hover {
  text-decoration: underline;
}
.wish-actions {
  margin-top: 12px;
}

.auth-form {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 0;
}
.auth-form h2 {
  margin-bottom: 24px;
}
.auth-form .field {
  margin-bottom: 16px;
}
.auth-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.auth-form p {
  line-height: 1.7;
  margin-bottom: 12px;
}
.link-wishes-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.auth-form .actions {
  margin-top: 24px;
}
.auth-links {
  margin-top: 20px;
  font-size: 0.9rem;
}
.auth-links a {
  color: var(--primary);
  text-decoration: none;
}
.auth-links a:hover {
  text-decoration: underline;
}

.my-wishes { padding: 40px 0; }
.my-wishes h1 { margin-bottom: 8px; }
.my-wishes h2 { margin: 32px 0 16px; }

.profile-banner {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.profile-banner p {
  margin: 0;
  font-size: 0.95rem;
}
.profile-banner-explain {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}
.profile-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.profile-url-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
}
.profile-url-box p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 12px;
}
.profile-url-field {
  display: flex;
  gap: 8px;
}
.profile-url-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: monospace;
  background: var(--card-bg);
  color: var(--text);
}
.btn-small {
  padding: 10px 20px;
  font-size: 0.9rem;
  margin-top: 0;
}

.comments-section {
  margin: 32px 0;
}
.comments-section h2 {
  margin-bottom: 16px;
}

.comment-form {
  margin-bottom: 20px;
}

.comment-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}
.comment-input:focus {
  outline: none;
  border-color: var(--primary);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-card {
  background: var(--card-bg);
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.comment-content {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-light);
}

.comment-count {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}

.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.wish-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-notice {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 8px;
}
.form-notice a { color: var(--primary); }

.wishes-sections {
  padding: 20px 0 40px;
}

.wishes-section {
  margin-bottom: 40px;
}
.wishes-section h2 {
  margin-bottom: 16px;
}

.wish-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}
.wish-input:focus {
  outline: none;
  border-color: var(--primary);
}

.wish-hint {
  font-size: 0.85rem;
  margin: 6px 0 0;
  min-height: 1.2em;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
  transition: background-color 0.2s, color 0.2s;
}
.wish-hint:empty {
  padding: 0;
}
.hint-short { color: #922b21; background-color: #fdedec; }
.hint-medium { color: #7e5109; background-color: #fef5e7; }
.hint-good { color: #1e8449; background-color: #eafaf1; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 16px;
  text-decoration: none;
  transition: background 0.2s;
}
.btn:hover { background: var(--primary-dark); }

.ai-summary-box {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 1px solid #a5b4fc;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}
.ai-summary-box h2 {
  color: #4338ca;
  margin-bottom: 12px;
  margin-top: 0px!important;
}
.ai-summary-content {
  color: #1e1b4b;
  line-height: 1.7;
}
.ai-summary-content ol {
  padding-left: 24px;
  margin: 12px 0;
}
.ai-summary-content li {
  margin-bottom: 10px;
  line-height: 1.6;
}
.ai-recommendations {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #6ee7b7;
}
.ai-recommendations h2 {
  color: #065f46;
}
.ai-recommendations .ai-summary-content {
  color: #064e3b;
}
.ai-party-matches {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
}
.ai-party-matches h2 {
  color: #92400e;
}
.ai-party-matches .ai-summary-content {
  color: #78350f;
}
.ai-summary-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 16px;
  font-style: italic;
}
.btn.btn-secondary {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fdba74;
  margin-top: 0;
  white-space: nowrap;
}
.btn.btn-secondary:hover {
  background: #ffedd5;
}

.recent-section {
  padding: 40px 0;
}
.recent-section h2 {
  margin-bottom: 16px;
}

.recent-wishes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-wish {
  display: block;
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}
.recent-wish .time {
  font-size: 0.85rem;
  color: var(--text-light);
}

.results { padding: 40px 0; }

.wish-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}
.wish-card h2 { margin-bottom: 8px; }
.wish-content { font-size: 1.1rem; }

.matches {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.match-card {
  background: var(--card-bg);
  padding: 20px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.match-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.match-rank {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-light);
  min-width: 36px;
}

.match-info { flex: 1; }
.match-info h3 { font-size: 1.1rem; }
.party-description {
  font-size: 0.9rem;
  color: var(--text-light);
}

.match-score {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 60px;
  text-align: right;
}

.score-high { color: var(--score-high); }
.score-medium { color: var(--score-medium); }
.score-low { color: var(--score-low); }

.match-bar-container {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 12px;
}

.match-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.match-bar.score-high { background: var(--score-high); }
.match-bar.score-medium { background: var(--score-medium); }
.match-bar.score-low { background: var(--score-low); }

.match-explanation {
  color: var(--text-light);
  font-size: 0.95rem;
}

.actions {
  text-align: center;
  padding: 20px 0;
}

.wish-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.wish-tags-inline {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag {
  display: inline-block;
  color: var(--text-light);
  font-size: 0.75rem;
  text-decoration: none;
}
.tag:hover {
  color: var(--primary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.tag-cloud-item {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
}
.tag-cloud-item:hover {
  color: var(--primary);
}

.tag-page { padding: 40px 0; }
.tag-page h1 { margin-bottom: 8px; }

.about { padding: 40px 0; }
.about h1 { margin-bottom: 16px; }
.about h2 { margin: 32px 0 12px; }
.about p { margin-bottom: 12px; line-height: 1.7; }
.about ol { margin: 12px 0; padding-left: 24px; line-height: 1.8; }

.stats { padding: 40px 0; }
.stats h1 { margin-bottom: 8px; }
.stats h2 { margin: 32px 0 16px; }

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
}
.stat-card h3 { font-size: 0.95rem; margin-bottom: 8px; }
.stat-score { font-size: 1.8rem; font-weight: 800; }
.stat-detail { font-size: 0.85rem; color: var(--text-light); }

.loading {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading p {
  color: var(--text-light);
  font-size: 1.05rem;
}

.wish-card-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.recent-wish-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}
.recent-wish-row .recent-wish {
  flex: 1;
  min-width: 0;
}
.wish-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.wish-meta .time {
  font-size: 0.85rem;
  color: var(--text-light);
}
.comment-count {
  text-decoration: none;
}
.wish-more {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-left: auto;
}
.wish-more:hover {
  text-decoration: underline;
}

.vote-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 40px;
}

.vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  color: var(--text-light);
  transition: all 0.15s;
}
.vote-btn:hover { border-color: var(--primary); color: var(--primary); }

.vote-active-up { color: var(--score-high); border-color: var(--score-high); background: #f0fdf4; }
.vote-active-down { color: var(--score-low); border-color: var(--score-low); background: #fef2f2; }

.vote-arrow { font-size: 0.85rem; }

.vote-score {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.related-articles {
  margin: 32px 0;
}
.related-articles h2 {
  margin-bottom: 12px;
}
.related-articles .article-preview h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.similar-wishes {
  margin: 32px 0;
}
.similar-wishes h2 {
  margin-bottom: 12px;
}
.similar-wish-wrapper {
  position: relative;
}
.similarity-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  z-index: 1;
}

.articles { padding: 40px 0; }
.articles h1 { margin-bottom: 8px; }
.articles-subtitle {
  color: var(--text-light);
  margin-bottom: 32px;
}

.articles-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-preview {
  display: block;
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}
.article-preview:hover {
  border-color: var(--primary);
}
.article-preview h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.article-excerpt {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 8px;
}
.article-date {
  font-size: 0.85rem;
  color: var(--text-light);
}

.article { padding: 40px 0; }
.article h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}
.article-meta {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.article-hint {
  color: var(--text-light);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 24px;
}
.article-body {
  line-height: 1.8;
  font-size: 1.05rem;
}
.article-body p {
  margin-bottom: 16px;
}
.article-segment {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  border-right: 0px solid transparent;
  transition: border-color 0.3s, border-right-width 0.3s;
}
.article-segment:hover {
  border-color: var(--border);
}
.segment-selected {
  border-color: var(--primary) !important;
}

.reaction-panel {
  position: sticky;
  bottom: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 24px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.reaction-panel.hidden {
  display: none;
}
.reaction-panel-text {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 12px;
  max-height: 80px;
  overflow: hidden;
}
.reaction-panel-actions {
  display: flex;
  gap: 10px;
}
.reaction-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  font-family: inherit;
}
.reaction-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.reaction-like:hover:not(:disabled) {
  background: #f0fdf4;
  border-color: var(--score-high);
  color: var(--score-high);
}
.reaction-dislike:hover:not(:disabled) {
  background: #fef2f2;
  border-color: var(--score-low);
  color: var(--score-low);
}
.reaction-active-like {
  background: #f0fdf4 !important;
  border-color: var(--score-high) !important;
  color: var(--score-high) !important;
}
.reaction-active-dislike {
  background: #fef2f2 !important;
  border-color: var(--score-low) !important;
  color: var(--score-low) !important;
}
.reaction-panel-stats {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-light);
}
.article-back {
  margin-top: 40px;
}

.explore-results {
  margin-top: 32px;
}
.explore-answer {
  margin-bottom: 32px;
}
.explore-answer h2 {
  margin-bottom: 12px;
}
.explore-answer-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  line-height: 1.7;
}
.explore-answer-content p {
  margin-bottom: 12px;
}
.explore-answer-content p:last-child {
  margin-bottom: 0;
}
.explore-wishes {
  margin-top: 24px;
}
.explore-wishes h2 {
  margin-bottom: 12px;
}
.explore-recent {
  margin-top: 32px;
}
.explore-recent h2 {
  margin-bottom: 12px;
}
.explore-queries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.explore-query-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}
.explore-query-card:hover {
  border-color: var(--primary);
}
.explore-query-question {
  font-weight: 500;
  margin-bottom: 4px;
}
.explore-query-meta, .explore-query-meta-detail {
  font-size: 0.8rem;
  color: var(--text-light);
}
.explore-query-meta-detail {
  margin-bottom: 16px;
}

.clusters-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.cluster-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}
.cluster-card:hover {
  border-color: var(--primary);
}
.cluster-card h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.cluster-summary {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.cluster-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}
.empty-state {
  color: var(--text-light);
  text-align: center;
  padding: 40px 0;
}
