/* ===== Reset & Variables ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #FF6B35;
  --primary-dark: #e05a26;
  --primary-light: rgba(255, 107, 53, 0.1);
  --accent: #4ECDC4;
  --accent-dark: #3ab5ad;
  --bg: #FFF8F5;
  --white: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #888;
  --border: #EBEBEB;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --max-w: 480px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI',
               'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Screens ===== */
.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.screen.active {
  display: block;
}

.screen-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ===== App Header ===== */
.app-header {
  text-align: center;
  padding: 8px 0 4px;
}

.app-logo {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.app-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.app-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* ===== Card ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  width: 100%;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  width: 100%;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,107,53,0.35);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(255,107,53,0.45);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.btn-ghost:hover { color: var(--text); }

.btn-large {
  padding: 16px 28px;
  font-size: 1.05rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s;
  margin-left: auto;
}
.btn-icon:hover { color: var(--primary); }

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 4px;
  align-self: flex-start;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--primary); }

.btn-text {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: underline;
  padding: 4px;
}
.btn-text:hover { color: var(--primary); }

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: #FAFAFA;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: monospace;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.select-wrapper {
  position: relative;
}
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  padding: 12px 36px 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: #FAFAFA;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 8px;
}

.radio-option { flex: 1; }

.radio-option input { display: none; }

.radio-option label {
  display: block;
  text-align: center;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.15s;
  background: #FAFAFA;
}

.radio-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.radio-option label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Location Row ===== */
.location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #F7F7F7;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.location-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #CCC;
  flex-shrink: 0;
  transition: background 0.3s;
}
.location-dot.loading {
  background: var(--primary);
  animation: blink 0.8s ease-in-out infinite;
}
.location-dot.success {
  background: #4CAF50;
  animation: blink 2.5s ease-in-out infinite;
}
.location-dot.error { background: #F44336; }

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(1.3); }
}

.location-text {
  font-size: 0.85rem;
  color: #555;
  flex: 1;
}

.location-row-btn {
  cursor: pointer;
  transition: background 0.15s;
}
.location-row-btn:hover,
.location-row-btn:active { background: #EFEFEF; }

.location-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ===== Setup Card ===== */
.setup-card {
  text-align: center;
}
.setup-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.setup-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ===== Roulette Screen ===== */
.roulette-header {
  text-align: center;
  padding: 8px 0 4px;
  width: 100%;
}
.roulette-title {
  font-size: 1.6rem;
  font-weight: 800;
}
.roulette-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
  min-height: 1.4em;
  transition: opacity 0.3s;
}

.roulette-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Roulette Card */
.roulette-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 20px 20px 56px;
  box-shadow: var(--shadow-md);
  border: 2px solid transparent;
  position: relative;
  cursor: default;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.roulette-card.clickable {
  cursor: pointer;
}
.roulette-card.clickable:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.roulette-card.spinning {
  border-color: var(--primary);
}
.roulette-card.spinning .roulette-card-content {
  animation: textFlicker 0.15s steps(1) infinite;
}

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

.roulette-card.revealed {
  animation: cardDrop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes cardDrop {
  0% { transform: translateY(-12px) scale(0.96); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.roulette-card.selected {
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(78,205,196,0.35);
  transform: scale(1.02);
}

.card-number {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.roulette-card.spinning .card-number {
  animation: spin 0.4s linear infinite;
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.roulette-card-content {
  flex: 1;
}

.card-placeholder {
  font-size: 1.8rem;
  opacity: 0.25;
  text-align: center;
  padding: 4px 0;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card-info .stars { color: #FFB800; }

.roulette-actions {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeIn 0.4s ease;
}

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

.roulette-actions.visible { display: flex; }

.select-instruction {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.btn-row .btn { flex: 1; }

/* ===== Detail Screen ===== */
.detail-winner-badge {
  background: linear-gradient(135deg, var(--primary), #ff9a6b);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 50px;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 10px rgba(255,107,53,0.35);
}

.detail-card {
  padding: 28px;
}

.detail-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 14px;
  color: var(--text);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #F5F5F5;
  border-radius: 20px;
  font-size: 0.83rem;
  font-weight: 600;
}
.detail-badge.open  { background: #E8F5E9; color: #388E3C; }
.detail-badge.closed { background: #FFEBEE; color: #C62828; }
.detail-badge.stars  { background: #FFF8E1; color: #F57F17; }
.detail-badge.price  { background: #F3E5F5; color: #6A1B9A; }

.detail-hours {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.detail-section {
  margin-bottom: 14px;
}

.detail-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.detail-section-value {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(4px);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-overlay.active { display: flex; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #EEE;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: rotate 0.75s linear infinite;
}

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

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

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A1A1A;
  color: #fff;
  padding: 11px 22px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 300;
  white-space: nowrap;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Today Hours ===== */
.today-hours {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 14px;
  font-weight: 600;
}

/* ===== Reviews (カード内) ===== */
.reviews-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}

.review-card {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.review-author {
  font-weight: 700;
  font-size: 0.85rem;
}

.review-stars {
  font-size: 0.75rem;
}

.review-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.review-text {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Ad Container ===== */
.ad-container {
  width: 100%;
  max-width: var(--max-w);
  min-height: 90px;
  overflow: hidden;
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
  .radio-option label { font-size: 0.78rem; padding: 8px 4px; }
  .app-title { font-size: 1.5rem; }
}
