/* Вся вёрстка в пикселях макета 1280×800; #stage масштабируется из main.js. */

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

html, body {
  width: 100%; height: 100%;
  background: #202124;
  overflow: hidden;
  touch-action: none; /* manipulation пускает панораму — тап отменяется, кнопки «залипают» */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 800px;
  transform: translate(-50%, -50%);
  background: #f6f8fc;
  font-family: Roboto, -apple-system, 'Segoe UI', Arial, sans-serif;
  color: #1f1f1f;
  display: flex; flex-direction: column;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.inert { pointer-events: none; }
svg { width: 24px; height: 24px; fill: #444746; display: block; }

/* ── Верхняя панель ─────────────────────────────────────────────────────── */

#topbar {
  height: 72px; flex: 0 0 72px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}
.tb-left { display: flex; align-items: center; gap: 8px; min-width: 240px; }
.icon-btn {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: #e2e7eb; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 24px; color: #444746; }
.logo-mark svg { width: 28px; height: 28px; fill: #0b57d0; }

.tb-search {
  flex: 1; max-width: 560px; height: 52px;
  background: #e9eef6; border-radius: 26px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  color: #444746; font-size: 18px;
}
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.lang { display: flex; background: #e9eef6; border-radius: 22px; padding: 4px; }
.lang-btn {
  min-width: 64px; height: 44px; border-radius: 18px;
  font-size: 17px; font-weight: 500; color: #444746;
}
.lang-btn.on { background: #d3e3fd; color: #0b57d0; }
.me {
  width: 44px; height: 44px; border-radius: 50%;
  background: #c2e7ff; display: flex; align-items: center; justify-content: center;
}
.me svg { width: 26px; height: 26px; fill: #00568c; }

/* ── Входящие ───────────────────────────────────────────────────────────── */

.shell { flex: 1; display: flex; min-height: 0; padding: 0 16px 16px 0; }

.rail {
  width: 88px; flex: 0 0 88px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding-top: 8px;
}
.rail-fab {
  width: 56px; height: 56px; border-radius: 18px;
  background: #c2e7ff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.rail-item { position: relative; width: 56px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; opacity: .75; }
.rail-item.on { background: #d3e3fd; opacity: 1; }
.rail-item b {
  position: absolute; top: -4px; right: 0;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: #0b57d0; color: #fff;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.list {
  flex: 1; background: #fff; border-radius: 16px;
  padding: 10px 8px; overflow: hidden;
  display: flex; flex-direction: column;
}
.list-label {
  font-size: 15px; font-weight: 500; color: #444746;
  padding: 8px 18px 10px;
  text-transform: uppercase; letter-spacing: .5px;
}
.row {
  display: flex; align-items: center; gap: 16px;
  height: 86px; padding: 0 18px;
  border-radius: 12px; text-align: left;
  font-size: 18px;
}
.row:active { background: #eef3fb; }
.row + .row { box-shadow: 0 -1px 0 #eceff3; }

.avatar {
  position: relative;
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%;
  color: #fff; font-size: 24px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
}
.badge {
  position: absolute; right: -4px; bottom: -4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #1e8e3e; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
}
.badge svg { width: 14px; height: 14px; fill: #fff; }

.row-sender { width: 230px; flex: 0 0 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5e5e5e; }
.unread .row-sender, .unread .row-subj { font-weight: 700; color: #1f1f1f; }
.read { opacity: .62; }
.row-star { flex: 0 0 24px; opacity: .5; }
.row-time { flex: 0 0 60px; text-align: right; font-size: 15px; color: #5e5e5e; }
.unread .row-time { color: #0b57d0; font-weight: 700; }

/* ── Письмо ─────────────────────────────────────────────────────────────── */

.mail {
  flex: 1; min-height: 0;
  margin: 0 16px 16px 16px;
  background: #fff; border-radius: 16px;
  display: flex; flex-direction: column;
}
.mail-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 28px 48px 20px;
  touch-action: pan-y;
}
.mail-subject { font-size: 30px; font-weight: 500; margin-bottom: 22px; text-wrap: balance; }
.mail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.mail-head .row-star { margin-left: auto; }
.mail-sender { font-size: 19px; font-weight: 700; }
.mail-tome { font-size: 15px; color: #5e5e5e; margin-top: 2px; }
.mail-body { font-size: 19px; line-height: 1.6; color: #1f1f1f; max-width: 980px; }
.mail-body p { margin-bottom: 14px; text-wrap: pretty; }
.lnk { color: #0b57d0; text-decoration: underline; word-break: break-all; }
.mail-btn-link { font-weight: 700; }

.quiz {
  flex: 0 0 auto;
  border-top: 1px solid #e0e3e7;
  background: #fafcff;
  border-radius: 0 0 16px 16px;
  padding: 18px 48px 22px;
}
.quiz-q { font-size: 22px; font-weight: 700; margin-bottom: 14px; text-wrap: balance; }
.quiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer {
  height: 64px; border-radius: 32px;
  border: 1px solid #747775;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  font-size: 19px; text-align: left;
  background: #fff;
}
.answer:active { background: #d3e3fd; border-color: #d3e3fd; }
.answer-key {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
  background: #e9eef6; color: #0b57d0;
  font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Вердикт и финал ────────────────────────────────────────────────────── */

.verdict {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px 16px;
}
.card {
  width: 760px; max-height: 100%;
  background: #fff; border-radius: 24px;
  padding: 40px 56px 36px;
  text-align: center;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(32,33,36,.1);
}
.card.wide { width: 880px; padding: 40px 64px 36px; }
.card.wide .mark { width: 84px; height: 84px; margin-bottom: 14px; }
.card.wide .mark svg { width: 46px; height: 46px; }
.mark {
  width: 96px; height: 96px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.mark svg { width: 52px; height: 52px; fill: #fff; }
.mark.good { background: #1e8e3e; }
.mark.bad { background: #d93025; }
.card h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; text-wrap: balance; }
.verdict-text { font-size: 21px; font-weight: 500; margin-bottom: 14px; text-wrap: balance; }
.verdict-explain { font-size: 19px; line-height: 1.55; color: #444746; text-wrap: pretty; text-align: center; }
.btns { display: flex; gap: 14px; justify-content: center; margin-top: 26px; }
.btn {
  min-width: 240px; height: 64px; border-radius: 32px;
  font-size: 20px; font-weight: 500;
  padding: 0 32px;
}
.btn.filled { background: #0b57d0; color: #fff; }
.btn.filled:active { background: #0842a0; }
.btn.tonal { background: #d3e3fd; color: #0b57d0; }
.btn.tonal:active { background: #b7d0f8; }

.card.wide h2 { margin-bottom: 12px; }
.card.wide .verdict-text { margin-bottom: 28px; }
.card.wide .btns { margin-top: 30px; }
.final-intro { font-size: 18px; line-height: 1.5; color: #444746; margin-bottom: 22px; text-wrap: pretty; }
/* Признаки в две колонки: список вдвое короче по высоте, кнопка поднимается. */
.flags {
  list-style: none; text-align: left; margin-bottom: 26px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px 28px;
}
.flags li {
  display: flex; align-items: center; gap: 12px;
  font-size: 18px; line-height: 1.35;
}
.li-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #fce8e6; display: flex; align-items: center; justify-content: center; }
.li-icon svg { width: 18px; height: 18px; fill: #d93025; }
.final-outro { font-size: 20px; font-weight: 700; }
