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

html, body {
  height: 100%;
  background: #ede9e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  overflow: hidden;
}

.card-header {
  background: #1e3a5f;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 14px;
}

.input-field {
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

textarea.input-field {
  resize: vertical;
  min-height: 44px;
}

.btn {
  background: #f3f4f6;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  min-width: 75px;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #e5e7eb;
}

.btn:active {
  background: #d1d5db;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:active {
  background: #1e40af;
}

.btn-danger {
  color: #dc2626;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #fef2f2;
}

.label {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
  display: block;
}

.statusbar {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 6px 14px;
  font-size: 12px;
  display: flex;
  gap: 20px;
  color: #6b7280;
}

.statusbar span {
  padding-left: 8px;
  border-left: 1px solid #e5e7eb;
}

.statusbar span:first-child { border-left: none; }

.wordart {
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-weight: bold;
  filter: drop-shadow(2px 3px 2px rgba(0,0,0,0.3));
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.1;
  animation: wa-hue 4s linear infinite;
}

@keyframes wa-hue {
  0% { color: #e11d48; }
  20% { color: #ca8a04; }
  40% { color: #16a34a; }
  60% { color: #2563eb; }
  80% { color: #7c3aed; }
  100% { color: #e11d48; }
}

.wordart-letter {
  display: inline-block;
  font-size: inherit;
  animation: wa-wave 2.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.07s);
}

.wordart-space {
  display: inline-block;
  width: 0.4em;
}

@keyframes wa-wave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

body {
  display: flex;
  flex-direction: column;
}

.master-body {
  overflow: hidden;
}

.master-header {
  text-align: center;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.master-header .wordart {
  font-size: clamp(36px, 6vw, 64px);
}

.master-content {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.master-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.master-right {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.profile-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.profile-card .card-body {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

.profile-item {
  margin-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 8px;
}

.profile-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.profile-q {
  font-size: 15px;
  font-weight: 600;
  color: #1e3a5f;
  margin-bottom: 2px;
}

.profile-a {
  font-size: 22px;
  color: #1f2937;
  line-height: 1.3;
  word-break: break-word;
}

.waiting-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.waiting-container h2 {
  font-size: 20px;
  color: #1e3a5f;
}

.waiting-container .player-count {
  font-size: 48px;
  font-weight: 700;
  color: #1e3a5f;
}

.waiting-hint {
  font-size: 15px;
  color: #6b7280;
  text-align: center;
}

.qr-block {
  text-align: center;
}

.qr-block img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  image-rendering: pixelated;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 500px;
}

.player-chip {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
}

.player-chip.done {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.chart-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chart-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-name {
  width: 140px;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.chart-bar-wrap {
  flex: 1;
  height: 28px;
  background: #f3f4f6;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 6px;
  min-width: 0;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  transition: width 0.4s ease;
  white-space: nowrap;
  overflow: hidden;
}

.chart-bar.correct {
  background: #16a34a;
}

.chart-bar.zero {
  background: transparent;
  color: transparent;
}

.chart-vote-status {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  padding: 6px;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

.reveal-answer {
  text-align: center;
  padding: 12px;
  margin-top: 8px;
}

.reveal-answer .correct-name {
  font-size: 36px;
  font-weight: bold;
  color: #16a34a;
  text-transform: uppercase;
}

.reveal-answer .label {
  font-size: 14px;
  color: #4b5563;
}

.player-body {
  background: #ede9e0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.player-header {
  text-align: center;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.player-header .wordart {
  font-size: clamp(22px, 5.5vw, 38px);
}

.player-content {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.player-section {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.player-section.active {
  display: flex;
}

.name-input-group {
  display: flex;
  gap: 8px;
}

.name-input-group .input-field { flex: 1; }

.form-scroll {
  overflow-y: auto;
  max-height: 60vh;
}

.form-group {
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 4px;
}

.vote-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.vote-name-btn {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  min-width: 80px;
  text-align: center;
  color: #1f2937;
  transition: border-color 0.15s, background 0.15s;
}

.vote-name-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.vote-name-btn.selected {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.vote-status {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.host-controls {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.host-controls.visible {
  display: flex;
}

.host-controls .btn {
  width: 100%;
}

.player-answer-box {
  text-align: center;
  padding: 20px;
}

.player-answer-box .big-name {
  font-size: 28px;
  font-weight: 700;
  color: #16a34a;
}

.player-answer-box .your-vote {
  font-size: 14px;
  color: #6b7280;
  margin-top: 10px;
}

.lobby-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.lobby-chip {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
}

.lobby-chip.ready {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.lobby-waiting {
  text-align: center;
  font-size: 16px;
  color: #1e3a5f;
  padding: 12px;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.admin-badge {
  font-size: 11px;
  background: #1e3a5f;
  color: #fff;
  padding: 2px 12px;
  font-weight: 600;
  text-align: center;
  border-radius: 4px;
  display: inline-block;
}

.form-step { text-align:center; margin-bottom:6px; font-size:13px; color:#1e3a5f; font-weight:600; }
.form-nav { display:flex; align-items:center; justify-content:space-between; padding-top:8px; border-top:1px solid #e5e7eb; }
.form-nav .btn { min-width:80px; }
.form-nav span { font-size:12px; color:#6b7280; }
.form-error { color:#dc2626; font-size:12px; display:none; text-align:center; padding:4px; }
