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

:root {
  --primary: #FF6B35;
  --primary-dark: #e55a27;
  --secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #888;
  --border: #e0e0e0;
  --card-bg: #ffffff;
  --bg: #fafafa;
  --radius: 16px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 48px;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
  text-align: center;
  padding: 32px 0 16px;
}

.logo {
  font-size: 56px;
  margin-bottom: 8px;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.tagline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Location */
.location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.idle    { background: #ccc; }
.dot.loading { background: #FFC107; animation: pulse 1s infinite; }
.dot.success { background: #4CAF50; }
.dot.error   { background: #f44336; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Manual location */
.manual-location {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.coord-inputs {
  display: flex;
  gap: 8px;
}

.coord-inputs input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.coord-inputs input:focus {
  border-color: var(--primary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
  padding: 4px;
}

/* Location map */
#location-map {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
  margin-top: 6px;
}

/* Distance buttons */
.distance-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dist-btn {
  flex: 1;
  min-width: 60px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.dist-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff5f2;
}

.dist-btn:hover:not(.active) {
  border-color: #ccc;
  color: var(--text);
}

/* Custom input */
.custom-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.custom-input input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.custom-input input:focus {
  border-color: var(--primary);
}

.unit {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Genre buttons */
.genre-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.genre-btn {
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.genre-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff5f2;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(255,107,53,0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,107,53,0.4);
}

.btn-primary:disabled {
  background: #ddd;
  color: #aaa;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: #ebebeb;
}

.btn-map {
  background: #4285F4;
  color: white;
  box-shadow: 0 4px 16px rgba(66,133,244,0.3);
}

.btn-map:hover {
  background: #3574e2;
  transform: translateY(-1px);
}

/* Loading */
#screen-loading {
  min-height: 100vh;
  justify-content: center;
  align-items: center;
}

.loading-content {
  text-align: center;
}

.spinner {
  font-size: 64px;
  animation: spin 0.8s ease-in-out infinite;
  display: block;
  margin-bottom: 24px;
}

@keyframes spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

.loading-text {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Result */
.result-header {
  text-align: center;
  padding: 24px 0 8px;
}

.result-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 4px solid var(--primary);
}

.result-icon {
  font-size: 48px;
}

.result-name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
}

.result-cuisine {
  font-size: 13px;
  color: white;
  background: var(--primary);
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 600;
  align-self: center;
}

.result-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.result-address {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-count {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-decide {
  background: #22c55e;
  color: white;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(34,197,94,0.35);
}

.btn-decide:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* 診断画面 */
#screen-diagnosis {
  min-height: 100vh;
  justify-content: flex-start;
  align-items: center;
  padding-top: 32px;
}

.diagnosis-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 16px 48px;
}

.diagnosis-emoji {
  font-size: 72px;
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.diagnosis-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
}

.diagnosis-desc {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.diagnosis-spins {
  background: #fff5f2;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.stats-box {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stats-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.stats-label {
  width: 80px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.stats-bar-wrap {
  flex: 1;
  background: #f0f0f0;
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}

.stats-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.6s ease;
}

.stats-num {
  width: 36px;
  text-align: right;
  font-weight: 700;
  color: var(--text);
  font-size: 12px;
}

/* Error */
#screen-error {
  min-height: 100vh;
  justify-content: center;
  align-items: center;
}

.error-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.error-icon {
  font-size: 56px;
}

.error-content h2 {
  font-size: 20px;
  font-weight: 700;
}

.error-content p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 280px;
  line-height: 1.6;
}

@media (max-width: 400px) {
  .genre-options {
    grid-template-columns: 1fr 1fr;
  }
}
