/* rel — design tokens and base styles */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Syne:wght@700;800&display=swap');

:root {
  --bg:        #f5f3ee;
  --bg1:       #ffffff;
  --bg2:       #eef0f7;
  --bg3:       #e2e8f5;
  --line:      #dde3f0;
  --line2:     #c8d0e8;
  --text:      #2a2d3e;
  --text2:     #5a5f7a;
  --text3:     #9098b8;
  --gold:      #f5a623;
  --gold2:     #ffc054;
  --sage:      #4caf82;
  --rose:      #f06878;
  --blue:      #4d8df5;
  --purple:    #9b7fe8;
  --active:    #4d8df5;
  --r:         12px;
  --r2:        20px;
  --panel-msg: 290px;
  --panel-vid: 200px;
  --hdr:       54px;
  --status-bar: 28px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);

  /* compat aliases */
  --surface: var(--bg1);
  --surface2: var(--bg2);
  --border: var(--line);
  --muted: var(--text3);
}

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

html, body { height: 100%; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

/* ── APP WRAPPER ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── TOP BAR ── */
#hdr {
  height: var(--hdr);
  background: var(--bg1);
  border-bottom: 2px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(77,141,245,0.06);
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--blue);
  letter-spacing: -0.5px;
  margin-right: 4px;
}

.world-selector {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 2px solid var(--line2);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: 13px;
  color: var(--text2);
  position: relative;
  font-weight: 700;
}
.world-selector:hover {
  border-color: var(--blue);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(77,141,245,0.12);
}

.world-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 2px rgba(76,175,130,0.25);
  flex-shrink: 0;
}

.world-pill {
  font-size: 13px;
  color: var(--text2);
  font-weight: 700;
}

.world-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg1);
  border: 2px solid var(--line2);
  border-radius: var(--r2);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(77,141,245,0.12);
}
.world-selector:hover .world-dropdown,
.world-selector:focus-within .world-dropdown {
  display: block;
}
.world-dropdown a {
  display: block;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text2);
  transition: background var(--transition);
  font-weight: 600;
}
.world-dropdown a:hover { background: var(--bg2); color: var(--text); }

.hdr-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex-shrink: 0; }

/* ── ICON BUTTON ── */
.ib {
  width: 36px; height: 36px;
  border-radius: var(--r);
  border: 2px solid transparent;
  background: transparent;
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
  font-size: 17px;
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
}
.ib:hover { background: var(--bg2); color: var(--blue); border-color: var(--line2); }
.ib.active, .ib.on { color: var(--blue); border-color: var(--blue); background: rgba(77,141,245,0.1); }
.ib.rose { color: var(--rose); }
.ib.rose:hover { background: rgba(240,104,120,0.1); border-color: var(--rose); }
.ib.danger { color: var(--rose); }
.ib.danger:hover { background: rgba(240,104,120,0.1); border-color: var(--rose); }

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 12px;
  color: var(--text2);
  padding: 4px 10px;
  background: var(--bg2);
  border: 2px solid var(--line2);
  border-radius: 999px;
  font-weight: 700;
}

/* ── SCROLLBAR GLOBAL ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 3px; }

/* ── ANIMATIONS ── */
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--rose); }
  50% { opacity: 0.5; box-shadow: 0 0 14px var(--rose); }
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.hidden { display: none !important; }

/* ── AUTH PAGES ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8f0fe 0%, #f5f3ee 50%, #e8f8f2 100%);
  font-family: 'Nunito', sans-serif;
}

.auth-card {
  background: var(--bg1);
  border: 2px solid var(--line2);
  border-radius: var(--r2);
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(77,141,245,0.12);
}

.auth-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--blue);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -1px;
}

.auth-tagline {
  text-align: center;
  color: var(--text3);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 28px;
}

.auth-card h1 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 20px;
  font-weight: 800;
  text-align: center;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg2);
  border: 2px solid var(--line2);
  border-radius: var(--r);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77,141,245,0.12);
}
.auth-card input::placeholder { color: var(--text3); }

.auth-card button[type="submit"] {
  width: 100%;
  padding: 13px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(77,141,245,0.3);
}
.auth-card button[type="submit"]:hover {
  background: #3a7ae0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(77,141,245,0.4);
}

.auth-link {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text3);
  font-weight: 600;
}
.auth-link a { color: var(--blue); font-weight: 700; }
.auth-link a:hover { text-decoration: underline; }

.auth-error {
  background: rgba(240,104,120,0.08);
  border: 2px solid rgba(240,104,120,0.3);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rose);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-error::before { content: '\26A0\FE0F'; }

/* ── HOME PAGE ── */
.home-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f0fe 0%, #f5f3ee 50%, #e8f8f2 100%);
}

.home-hdr {
  height: var(--hdr);
  background: var(--bg1);
  border-bottom: 2px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(77,141,245,0.06);
}

.home-hdr .logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; color: var(--blue); }

.home-hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.home-body {
  flex: 1;
  overflow-y: auto;
  padding: 36px;
  display: flex;
  gap: 40px;
  align-items: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}

.home-section { flex: 1; min-width: 0; }
.home-section-title {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 800;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.world-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg1);
  border: 2px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  color: var(--text);
}
.world-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 16px rgba(77,141,245,0.12);
  transform: translateY(-1px);
}

.world-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
}
.world-card.kind-whole .world-card-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(245,166,35,0.2); }
.world-card.kind-group .world-card-dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(77,141,245,0.2); }

.world-card-name { font-size: 14px; color: var(--text); flex: 1; font-weight: 700; }
.world-card-kind { font-size: 11px; color: var(--text3); font-weight: 600; }

.empty-msg {
  font-size: 14px;
  color: var(--text3);
  padding: 20px 0;
  font-weight: 600;
  text-align: center;
}
.empty-msg::before { content: '\1F30D'; display: block; font-size: 32px; margin-bottom: 8px; }

.create-form {
  background: var(--bg1);
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: 0 4px 16px rgba(77,141,245,0.06);
}

.create-form label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.create-form input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg2);
  border: 2px solid var(--line2);
  border-radius: var(--r);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  margin-bottom: 12px;
  display: block;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.create-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77,141,245,0.12);
}
.create-form input::placeholder { color: var(--text3); }

.create-form button[type="submit"] {
  padding: 10px 20px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(77,141,245,0.3);
}
.create-form button[type="submit"]:hover {
  background: #3a7ae0;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(77,141,245,0.4);
}

/* ── Mobile base ── */
@media (max-width: 640px) {
  body { overflow: hidden; font-size: 15px; }
  .auth-card { margin: 16px; padding: 32px 24px; }
  .auth-logo { font-size: 28px; }
  .home-body { flex-direction: column; padding: 20px; gap: 24px; }
  .world-card { padding: 16px; }
}
