:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --radius: 18px;
  --header-h: 56px;
  --tap: 44px;
  --primary: #3b82f6;
  --accent: var(--primary);
  --danger-soft: #F5DDDD;
  --danger-text: #7A1F1F;
  --danger-border: #E6BABA;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, #f4f7ff 0%, var(--bg) 60%, #f8fafc 100%);
}

.app-viewport{
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 14px 10px 22px;
}

.phone-shell{
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header{
  height: var(--header-h);
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap) var(--tap);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.icon-btn{
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:active{ transform: translateY(1px); }
.icon-btn:hover{ background: rgba(59,130,246,0.08); }

.app-title{
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Avatar */
.avatar-btn{
  position: relative;
  width: var(--tap);
  height: var(--tap);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f1f5f9;
  padding: 0;
}
.avatar-btn img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rating-badge{
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(59,130,246,0.95);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Content */
.app-content{
  padding: 16px 16px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.h1{
  font-size: 22px;
  margin: 6px 0 14px;
  letter-spacing: -0.02em;
}

.p{
  margin: 10px 0;
  color: var(--text);
  line-height: 1.45;
}

.muted{ color: var(--muted); }

.divider{
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

a{ color: var(--primary); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* Buttons */
.btn{
  width: 100%;
  border: 0;
  border-radius: 14px;
  height: 52px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before{
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}
.btn-primary,
.btn--primary{
  background: var(--accent);
  color: #0A1A19;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
}
.btn-ghost,
.btn--ghost{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-danger,
.btn--danger{
  background: var(--danger-soft);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
}
.btn-danger:hover,
.btn--danger:hover{
  background: #EFD2D2;
}
.btn-danger:active,
.btn--danger:active{
  background: #E6C2C2;
}

/* Dropdown menu */
.menu{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}
.menu.open{ display: block; }
.menu-backdrop{
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.25);
}
.menu-sheet{
  position: absolute;
  right: 10px;
  top: 70px;
  width: min(320px, calc(100vw - 20px));
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.menu-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}
.menu-item:last-child{ border-bottom: 0; }
.menu-item small{ display:block; color: var(--muted); font-weight: 600; margin-top: 2px; }
.menu-sep{
  height: 10px;
  background: rgba(15,23,42,0.03);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: rgba(15,23,42,0.92);
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 90vw;
  display: none;
  z-index: 100;
}
.toast.show{ display: block; }

.menu-btn {
  all: unset;                 /* 🔥 убираем браузерные стили кнопки */
  display: block;
  width: 100%;
  cursor: pointer;
}

.menu-btn.menu-item {
  /* на случай, если .menu-item — a */
  color: inherit;
}
