:root {
  color-scheme: light dark;
  --bg: #f5f3eb;
  --surface: #fffefa;
  --ink: #22241e;
  --muted: #777a70;
  --line: #deded4;
  --lime: #c7f06b;
  --accent: #38532a;
  --red: #ed6659;
  --soft: #ebece3;
  --shadow: 0 22px 70px #252b1710;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #87b94c;
  outline-offset: 3px;
}

.shell {
  max-width: 1120px;
  margin: auto;
  padding:
    max(27px, env(safe-area-inset-top))
    max(32px, env(safe-area-inset-right))
    max(80px, env(safe-area-inset-bottom))
    max(32px, env(safe-area-inset-left));
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font: 700 25px "Space Grotesk", sans-serif;
  letter-spacing: -1.4px;
}

.brand-dot { color: var(--accent); }

.logo {
  width: 36px;
  height: 36px;
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 12px;
  display: grid;
  place-items: center;
  transform: rotate(-9deg);
}

.logo svg { transform: rotate(9deg); }

.top-right {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 9px;
}

.online { width: 7px; height: 7px; border-radius: 50%; background: #7cb44e; }

.main {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
}

.screen { display: none; width: 100%; animation: enter 0.3s ease; }
.screen.active { display: block; }

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

.home-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 60px;
  padding: 70px 0;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Space Grotesk", sans-serif; }

h1 {
  font-size: clamp(65px, 8.2vw, 112px);
  letter-spacing: -0.085em;
  line-height: 0.97;
  margin: 24px 0;
}

h1 em { font-style: normal; color: var(--accent); }

.lead {
  font-size: 19px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 440px;
}

.home-actions { max-width: 420px; margin-top: 36px; }

.btn {
  border: 0;
  border-radius: 15px;
  padding: 16px 21px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s, filter 0.15s;
}

.btn:hover { transform: translateY(-2px); filter: brightness(0.97); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-lime { background: var(--lime); color: #1b2815; }
.btn-outline { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-danger { background: var(--red); color: #241a18; }
.btn-wide { width: 100%; }
.btn svg { width: 19px; height: 19px; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.separator {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  margin: 23px 0;
}

.separator:before, .separator:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.join-row { display: flex; gap: 9px; }

.code-input {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 15px;
  padding: 15px 18px;
  color: var(--ink);
  font: 700 17px "Space Grotesk", sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.error {
  color: #c94c41;
  font-size: 13px;
  margin: 12px 2px 0;
  display: none;
}

.error.show { display: block; }

.art { height: 440px; position: relative; display: grid; place-items: center; }

.art-circle {
  width: min(100%, 430px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--lime);
  border: 2px solid var(--ink);
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: 20px 20px 0 var(--soft);
  overflow: hidden;
}

.art-circle:before, .art-circle:after {
  content: "";
  position: absolute;
  width: 370px;
  height: 370px;
  border: 2px solid #24371c35;
  border-radius: 50%;
}

.art-circle:before { transform: translate(-140px, 170px); }
.art-circle:after { transform: translate(170px, -150px); }

.wave {
  display: flex;
  gap: 9px;
  align-items: center;
  height: 170px;
  z-index: 1;
}

.wave span {
  width: 16px;
  height: var(--h);
  background: #23361b;
  border-radius: 20px;
}

.floating {
  position: absolute;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 15px;
  padding: 12px 17px;
  box-shadow: 5px 6px 0 #1c271626;
  font-size: 13px;
  font-weight: 700;
  z-index: 2;
}

.float-one { top: 45px; left: -5px; transform: rotate(-8deg); }
.float-two { right: -4px; bottom: 55px; transform: rotate(7deg); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #74bb4b;
  margin-right: 6px;
}

.footnote { font-size: 12px; color: var(--muted); margin-top: 25px; }

.panel {
  max-width: 540px;
  margin: 55px auto;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 28px;
  padding: 43px;
  box-shadow: var(--shadow);
  text-align: center;
}

.panel-icon {
  height: 70px;
  width: 70px;
  background: var(--lime);
  border: 1.5px solid var(--ink);
  border-radius: 23px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  transform: rotate(-7deg);
}

.panel-icon svg { height: 33px; width: 33px; transform: rotate(7deg); }
.ended-icon { background: #f6c9b5; }

.panel h2 { font-size: 38px; letter-spacing: -1.9px; margin-bottom: 10px; }
.subtle { color: var(--muted); line-height: 1.6; }

.room-label { margin-top: 30px; }

.room-code {
  font: 700 clamp(34px, 7vw, 56px) "Space Grotesk", sans-serif;
  letter-spacing: 7px;
  margin: 25px 0;
}

.small-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.panel-actions { display: flex; gap: 10px; justify-content: center; margin-top: 27px; }
.panel-actions .btn { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin: 16px 0 0; }

.call { max-width: 850px; margin: 35px auto 0; }

.call-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 15px;
  margin-bottom: 24px;
}

.call-header h2 { font-size: 48px; letter-spacing: 4px; margin: 5px 0; }
.call-header .btn { padding: 12px 16px; }

.status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status .dot { margin: 0; background: #9da59a; }

.call-board {
  border: 1.5px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  padding: 23px;
  box-shadow: var(--shadow);
}

.board-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 19px; }
.board-top strong { font-size: 13px; }
.count { background: var(--soft); padding: 7px 12px; border-radius: 30px; font-size: 12px; }

.people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }

.person {
  border: 1.5px solid var(--line);
  border-radius: 19px;
  padding: 20px 15px 14px;
  text-align: center;
  position: relative;
  min-height: 182px;
  background: var(--bg);
  transition: all 0.2s;
}

.person.speaking {
  border-color: #76a43c;
  background: color-mix(in srgb, var(--lime) 24%, var(--surface));
  box-shadow: 0 0 0 3px #9fd65750;
}

.person.speaking:before {
  content: attr(data-speaking);
  position: absolute;
  top: 11px;
  left: 12px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
}

.avatar {
  width: 66px;
  height: 66px;
  border-radius: 22px;
  margin: 10px auto 13px;
  display: grid;
  place-items: center;
  font: 700 25px "Space Grotesk", sans-serif;
  background: #d9e1cf;
  color: #3d4d33;
  position: relative;
}

.person:nth-child(2) .avatar { background: #f3d9c4; color: #855a42; }
.person:nth-child(3) .avatar { background: #d4dafa; color: #4b5691; }
.person:nth-child(4) .avatar { background: #f0d5e6; color: #8e4a76; }
.person:nth-child(5) .avatar { background: #f1e6b9; color: #746322; }
.person.speaking .avatar { outline: 3px solid #8fc04b; outline-offset: 4px; }

.muted-icon {
  position: absolute;
  right: -8px;
  bottom: -7px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  padding: 6px;
  display: grid;
  place-items: center;
}

.muted-icon svg { width: 13px; height: 13px; }
.person-name { font-weight: 700; font-size: 14px; }
.person-meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.person-meta.lost { color: #d65349; }

.empty { text-align: center; padding: 42px 10px; }
.empty-graphic { font-size: 44px; margin-bottom: 14px; }
.empty h3 { font-size: 24px; letter-spacing: -0.8px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; }

.controls { display: flex; justify-content: center; gap: 12px; margin-top: 25px; }
.controls .btn { min-width: 155px; }
.call-tip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }

#tapBtn:not(.hidden) { display: flex; margin: 18px auto 0; max-width: 320px; }

.footer { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); gap: 10px; }

.language-select {
  appearance: auto;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
  font: 700 12px "DM Sans", sans-serif;
  cursor: pointer;
  max-width: 130px;
}

.hidden { display: none !important; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171c18;
    --surface: #242b25;
    --ink: #f0f3e9;
    --muted: #a0aa9d;
    --line: #414b40;
    --lime: #b9e96a;
    --accent: #c1e994;
    --soft: #303a30;
    --shadow: 0 22px 70px #0004;
  }

  .logo, .panel-icon, .art-circle { border-color: #182117; }
  .art-circle { box-shadow: 20px 20px 0 #2b382a; }
  .wave span { background: #23361b; }
  .floating { border-color: #aab6a0; }
  .btn-primary { background: var(--lime); color: #1c2818; }
  .btn-lime { color: #1c2818; }
  .person.speaking { background: #33472b; }
  .avatar { color: #263621; }
}

@media (max-width: 760px) {
  .shell { padding: 21px 19px 90px; }
  .home-layout { grid-template-columns: 1fr; gap: 8px; padding: 52px 0 20px; }
  .home-layout h1 { font-size: 76px; }
  .art { height: 280px; order: -1; }
  .art-circle { width: 245px; }
  .wave { transform: scale(0.65); }
  .float-one { left: 3%; top: 20px; }
  .float-two { right: 2%; bottom: 20px; }
  .lead { font-size: 16px; }
  .home-actions { margin-top: 25px; }
  .panel { padding: 32px 23px; margin: 35px auto; }
  .panel h2 { font-size: 31px; }
  .call-header h2 { font-size: 36px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person { min-height: 175px; }
  .footer { padding-bottom: 20px; }
}

@media (max-width: 480px) {
  .top-right [data-i18n], .top-right .online { display: none; }
}

@media (max-width: 390px) {
  .home-layout h1 { font-size: 65px; }
  .people { gap: 9px; }
  .person { padding: 14px 8px; }
  .controls .btn { min-width: 0; flex: 1; }
  .call-header .btn { font-size: 12px; }
  .room-code { letter-spacing: 4px; }
}
