* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #EDEBE7;
  font-family: 'Nunito', system-ui, sans-serif;
  color: #3D3D3D;
}
a { color: #1CA8DD; text-decoration: none; }
a:hover { color: #0E86B5; text-decoration: underline; }
input, select, button { font-family: 'Nunito', system-ui, sans-serif; }
input:focus, select:focus { outline: 2px solid #1CA8DD; outline-offset: 0; }
button { cursor: pointer; }

#frame {
  display: flex;
  justify-content: center;
  min-height: 100dvh;
}
#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  background: #F7F6F4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 460px) {
  #frame { padding: 24px 0; }
  #app {
    min-height: calc(100dvh - 48px);
    max-height: 900px;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(40, 36, 30, .18);
  }
}

@keyframes scanline { 0% { top: 8%; } 50% { top: 88%; } 100% { top: 8%; } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideUp { 0% { transform: translateY(40px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* ---------- shared bits ---------- */
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid #E2DFDA;
  font-size: 15px;
  background: #fff;
  color: #3D3D3D;
}
.input::placeholder { color: #B4B1AC; }
.btn-primary {
  padding: 15px;
  border-radius: 14px;
  border: none;
  background: #EE404C;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.btn-primary:hover { background: #D93540; }
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #EBE8E3;
}
.page {
  padding: max(30px, env(safe-area-inset-top)) 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-title { font-size: 24px; font-weight: 900; color: #3D3D3D; }
.muted { color: #8A8A8A; font-weight: 600; }

.scroll-area { flex: 1; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }

/* ---------- tab bar ---------- */
.tabbar {
  display: flex;
  background: #fff;
  border-top: 1px solid #EBE8E3;
  padding: 8px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  padding: 6px 0;
}
.tabbar button span { font-size: 10px; font-weight: 800; }

/* ---------- overlays ---------- */
.overlay-full {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.overlay-sheet-back {
  position: absolute;
  inset: 0;
  background: rgba(30, 28, 26, .45);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 20;
}
.sheet {
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 24px calc(30px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp .3s ease-out;
}
.close-x {
  border: none;
  background: #F4F1EC;
  color: #8A8A8A;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
/* Invisible halo so the tap target is ~48px without changing the look. */
.close-x::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.close-x.dark { background: rgba(255,255,255,.15); color: #fff; }

.avatar {
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.err-inline { color: #EE404C; font-size: 12.5px; font-weight: 700; }
