:root {
  color-scheme: light;
  --ink: #121212;
  --paper: #f7f6f2;
  --surface: #ffffff;
  --surface-muted: #eceae4;
  --graphite: #2a2a2a;
  --grey: #74716a;
  --grey-light: #d8d5cc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.panel {
  width: min(100%, 440px);
  min-height: min(760px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--grey-light);
  border-radius: 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand,
.room-code,
.room-state,
.language-code {
  letter-spacing: 0;
}

.brand {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.room-code {
  margin: 0;
  padding: 7px 10px;
  color: var(--grey);
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--grey-light);
  border-radius: 999px;
}

.state,
#joinView {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

h1 {
  margin: 28px 0 22px;
  font-size: clamp(32px, 9vw, 48px);
  line-height: 0.96;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--grey);
  font-size: 17px;
  line-height: 1.45;
}

.room-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--grey);
  font-size: 14px;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.language-button {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--grey-light);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.language-button:active {
  transform: scale(0.98);
}

.language-button.selected {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.language-code {
  font-size: 12px;
  font-weight: 900;
  color: currentColor;
  opacity: 0.62;
}

.language-name {
  font-size: 15px;
  font-weight: 800;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  margin-top: auto;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-button {
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  font-weight: 800;
}

.primary-button:disabled {
  cursor: default;
  opacity: 0.36;
}

.secondary-button {
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--grey-light);
  font-weight: 800;
}

.primary-button:not(:disabled):active,
.secondary-button:active {
  transform: scale(0.98);
}

.caption-box {
  min-height: 180px;
  margin: 28px 0;
  padding: 18px;
  color: var(--grey);
  background: var(--surface-muted);
  border: 1px solid var(--grey-light);
  border-radius: 22px;
  font-size: 18px;
  line-height: 1.45;
}

.pulse-line {
  width: 100%;
  height: 48px;
  margin-top: 72px;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 16px;
}

.pulse-line.short {
  width: 72%;
  height: 22px;
  margin-top: 14px;
}

.pulse-line::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}

@media (max-width: 390px) {
  .shell {
    padding: 0;
  }

  .panel {
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
  }
}
