: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; }

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;
}

.navbar div {
  display: flex;
  gap: 20px;
}

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

.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; }

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

.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);
}

.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); }

.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:hover { border-color: var(--primary); }
.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;
}

.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;
}
.recent-wish-row .recent-wish {
  flex: 1;
}

.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);
}
