*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --purple: #6C5CE7;
  --purple-light: #a29bfe;
  --purple-dark: #5a4bd1;
  --green: #00b894;
  --green-dark: #00a381;
  --red: #ff6b6b;
  --red-dark: #ee5a5a;
  --orange: #fdcb6e;
  --bg: #f8f7ff;
  --card: #ffffff;
  --text: #2d3436;
  --text-soft: #636e72;
  --text-faint: #b2bec3;
  --border: #dfe6e9;
}

body {
  margin: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-x: hidden;
  position: relative;
}

/* Floating background shapes */
.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
}

.shape--1 {
  width: 300px;
  height: 300px;
  background: var(--purple);
  top: -80px;
  left: -80px;
  animation: float 8s ease-in-out infinite;
}

.shape--2 {
  width: 200px;
  height: 200px;
  background: var(--green);
  bottom: -60px;
  right: -40px;
  animation: float 10s ease-in-out infinite reverse;
}

.shape--3 {
  width: 150px;
  height: 150px;
  background: var(--orange);
  top: 40%;
  right: -50px;
  animation: float 12s ease-in-out infinite 2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

/* Card */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 28px;
  box-shadow:
    0 20px 60px rgba(108, 92, 231, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Header */
.header {
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
}

.header-icon {
  margin-bottom: 0.5rem;
}

.logo {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

/* Main */
.main {
  padding: 1.75rem 1.5rem 1.5rem;
}

.panel {
  transition: opacity 0.25s ease;
}

.panel.hidden {
  display: none;
}

/* Lobby */
.question {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Create button */
.btn-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-size: 1.15rem;
  padding: 1.1rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.35);
}

.btn-create:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(108, 92, 231, 0.45);
  transform: translateY(-1px);
}

.btn-icon {
  display: flex;
  align-items: center;
}

/* Divider */
.divider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

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

/* Join group */
.join-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.join-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
  text-align: center;
}

.join-row {
  display: flex;
  gap: 0.5rem;
}

.input {
  flex: 1;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.9rem 1rem;
  border: 3px solid var(--border);
  border-radius: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--text);
  background: #fafafe;
}

.input::placeholder {
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}

.input:focus {
  outline: none;
  border-color: var(--purple-light);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.btn-join {
  font-size: 1.1rem;
  padding: 0.9rem 1.5rem;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 184, 148, 0.3);
  white-space: nowrap;
}

.btn-join:hover:not(:disabled) {
  background: var(--green-dark);
  box-shadow: 0 6px 18px rgba(0, 184, 148, 0.4);
  transform: translateY(-1px);
}

/* Rejoin panel */
.rejoin-content {
  text-align: center;
  padding: 1rem 0;
}

.rejoin-title {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--purple);
}

.rejoin-info {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-soft);
}

.rejoin-info strong {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 1.2rem;
  letter-spacing: 0.12em;
  color: var(--text);
}

.rejoin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-secondary-outline {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1.5rem;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-secondary-outline:hover {
  background: #f5f5f5;
  border-color: var(--text-faint);
}

/* Waiting panel */
.waiting-content {
  text-align: center;
  padding: 1rem 0;
}

.waiting-title {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--purple);
}

.waiting-instruction {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-soft);
}

.room-code {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 1rem 2rem;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--purple);
  font-family: ui-monospace, "SF Mono", monospace;
  background: linear-gradient(135deg, #f8f7ff 0%, #eee8ff 100%);
  border: 3px dashed var(--purple-light);
  border-radius: 20px;
}

.pulse-ring {
  width: 12px;
  height: 12px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: var(--purple-light);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.8); opacity: 0; }
}

/* Status */
.status {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
  min-height: 1.5em;
  text-align: center;
}

.status--waiting {
  color: var(--text-faint);
}

.status--connected {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--green);
}

.call-timer {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: ui-monospace, "SF Mono", monospace;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  text-align: center;
  min-height: 1.5em;
  transition: color 0.3s ease;
}

.call-timer--warning {
  color: var(--red);
}

.status--error {
  color: var(--red);
}

/* In-call */
.call-content {
  text-align: center;
  padding: 1rem 0;
}

.call-visual {
  margin-bottom: 0.75rem;
}

.sound-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 48px;
}

.wave-bar {
  display: block;
  width: 6px;
  border-radius: 999px;
  background: var(--purple);
}

.wave-bar:nth-child(1) { animation: wave 1.2s ease-in-out 0s infinite; }
.wave-bar:nth-child(2) { animation: wave 1.2s ease-in-out 0.15s infinite; }
.wave-bar:nth-child(3) { animation: wave 1.2s ease-in-out 0.3s infinite; }
.wave-bar:nth-child(4) { animation: wave 1.2s ease-in-out 0.45s infinite; }
.wave-bar:nth-child(5) { animation: wave 1.2s ease-in-out 0.6s infinite; }

@keyframes wave {
  0%, 100% { height: 12px; opacity: 0.5; }
  50% { height: 40px; opacity: 1; }
}

.controls {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn-round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  background: none;
}

.btn-round svg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  padding: 18px;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-round-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}

/* Mute button */
.btn-mute svg {
  background: #f0efff;
  stroke: var(--purple);
}

.btn-mute:hover svg {
  background: #e4e0ff;
}

.btn-mute.muted svg {
  background: #fff0f0;
  stroke: var(--red);
}

.btn-mute.muted:hover svg {
  background: #ffe0e0;
}

/* End call button */
.btn-end svg {
  background: var(--red);
  stroke: #fff;
}

.btn-end:hover svg {
  background: var(--red-dark);
  transform: scale(1.05);
}

/* Guide section */
.panel--guide {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.guide-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.guide-step p {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  padding-top: 0.1rem;
}

.guide-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.guide-help {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-faint);
  text-align: center;
}

/* Footer */
.footer {
  padding: 1.25rem 1.5rem;
  background: #faf9ff;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-faint);
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer strong {
  color: var(--text-soft);
}

.footer-parents {
  margin-top: 1rem;
  text-align: left;
  max-width: 36em;
  margin-left: auto;
  margin-right: auto;
}

.footer-parents summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-soft);
  list-style: none;
}

.footer-parents summary::-webkit-details-marker {
  display: none;
}

.footer-parents summary::before {
  content: "+ ";
}

.footer-parents[open] summary::before {
  content: "\2212 ";
}

.footer-parents p {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-faint);
}
