/* Entré Café Quiz - Brand Colors */
:root {
  --brown-dark:  #2C1F14;
  --brown-mid:   #3D2B1F;
  --brown-light: #5C3D2E;
  --green:       #5B7A52;
  --green-light: #7A9B70;
  --cream:       #C4A882;
  --cream-light: #E8D5B7;
  --off-white:   #F5F0E8;
  --white:       #FFFFFF;
  --red:         #E8524A;
  --blue:        #4A90E8;
  --yellow:      #E8A84A;
  --purple:      #9B59B6;
}

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

html { font-size: 16px; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  background: var(--brown-dark);
  color: var(--off-white);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Layout ===== */
.app-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--brown-mid);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--green);
}

.header-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: 0.05em;
}

.header-sub {
  font-size: 0.75rem;
  color: var(--cream-light);
  opacity: 0.8;
}

.main-content {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Cards ===== */
.card {
  background: var(--brown-mid);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(196,168,130,0.2);
}

.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cream);
  margin-bottom: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
  letter-spacing: 0.03em;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--green-light); }

.btn-secondary {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--cream);
}
.btn-secondary:hover:not(:disabled) { background: rgba(196,168,130,0.1); }

.btn-danger {
  background: var(--red);
  color: var(--white);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
  width: auto;
}

/* ===== Form ===== */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.875rem;
  color: var(--cream-light);
}

.form-input {
  background: var(--brown-dark);
  border: 1px solid rgba(196,168,130,0.3);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--off-white);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  font-family: inherit;
}
.form-input:focus { border-color: var(--green); }
.form-input::placeholder { color: rgba(245,240,232,0.3); }

/* ===== State Badge ===== */
.state-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.state-waiting   { background: rgba(91,122,82,0.3);  color: var(--green-light); }
.state-grouping  { background: rgba(74,144,232,0.3); color: #7ab3f0; }
.state-question  { background: rgba(232,82,74,0.3);  color: #f07a72; }
.state-revealed  { background: rgba(232,168,74,0.3); color: #f0c172; }
.state-ranking   { background: rgba(155,89,182,0.3); color: #c390d8; }
.state-finished  { background: rgba(92,61,46,0.5);   color: var(--cream); }

/* ===== Team Badge ===== */
.team-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
}

/* ===== Score / Ranking ===== */
.ranking-list { display: flex; flex-direction: column; gap: 10px; }

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--brown-dark);
  border-radius: 10px;
  border-left: 4px solid transparent;
}

.ranking-rank {
  font-size: 1.5rem;
  font-weight: 900;
  width: 36px;
  text-align: center;
  color: var(--cream);
}
.rank-1 { color: #FFD700; }
.rank-2 { color: #C0C0C0; }
.rank-3 { color: #CD7F32; }

.ranking-name { flex: 1; font-size: 1rem; font-weight: 700; }
.ranking-members { font-size: 0.75rem; color: var(--cream-light); opacity: 0.7; }
.ranking-score { font-size: 1.4rem; font-weight: 900; color: var(--cream); }

/* ===== Timer ===== */
.timer-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  margin: 0 auto;
  background: conic-gradient(var(--green) var(--progress, 100%), var(--brown-dark) 0);
  transition: --progress 1s linear;
}
.timer-inner {
  background: var(--brown-mid);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-urgent { background: conic-gradient(var(--red) var(--progress, 100%), var(--brown-dark) 0) !important; }

/* ===== Question ===== */
.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--off-white);
  margin-bottom: 16px;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-btn {
  background: var(--brown-dark);
  border: 2px solid rgba(196,168,130,0.2);
  border-radius: 10px;
  padding: 14px 10px;
  color: var(--off-white);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: inherit;
  line-height: 1.4;
}
.choice-btn:hover { border-color: var(--green); background: rgba(91,122,82,0.15); }
.choice-btn.selected { border-color: var(--green); background: rgba(91,122,82,0.3); }
.choice-btn.correct { border-color: var(--green); background: rgba(91,122,82,0.5); color: #90EE90; }
.choice-btn.incorrect { border-color: var(--red); background: rgba(232,82,74,0.2); opacity: 0.6; }

/* ===== Loader ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(196,168,130,0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Waiting screen ===== */
.join-code-display {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--cream);
  text-align: center;
  padding: 16px;
}

.participant-count {
  text-align: center;
  font-size: 1.1rem;
  color: var(--cream-light);
}

.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.participant-chip {
  background: var(--brown-dark);
  border: 1px solid rgba(196,168,130,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.875rem;
  color: var(--cream-light);
}

/* ===== Alert ===== */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.alert-error   { background: rgba(232,82,74,0.2);  color: #f07a72; border: 1px solid rgba(232,82,74,0.4); }
.alert-success { background: rgba(91,122,82,0.2);  color: #90c87e; border: 1px solid rgba(91,122,82,0.4); }
.alert-info    { background: rgba(74,144,232,0.15); color: #7ab3f0; border: 1px solid rgba(74,144,232,0.3); }

/* ===== Answered state ===== */
.answered-icon {
  text-align: center;
  font-size: 3rem;
  padding: 20px;
}

/* ===== Admin overrides ===== */
.admin-wrapper {
  max-width: 900px;
  background: var(--brown-dark);
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .app-wrapper { max-width: 520px; }
}
