* {
  box-sizing: border-box;
}

:root {
  --bg: #07111f;
  --bg2: #0a2441;
  --panel: rgba(255,255,255,.96);
  --text: #172033;
  --muted: #65758b;
  --blue: #2f80ed;
  --green: #20c477;
  --yellow: #ffd166;
  --red: #ff5d6c;
  --purple: #8b5cf6;
  --soft: #edf6ff;
  --shadow: 0 22px 60px rgba(0,0,0,.24);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(81,199,255,.26), transparent 25%),
    radial-gradient(circle at 86% 15%, rgba(255,209,102,.24), transparent 25%),
    linear-gradient(135deg, var(--bg), var(--bg2) 58%, #063f45);
}

.app {
  width: min(1360px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0;
  display: grid;
  align-items: center;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.start-card,
.final-card,
.topbar,
.helper,
.game-card,
.side-card {
  background: var(--panel);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.start-card,
.final-card {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 42px;
  text-align: center;
}

.logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  background: linear-gradient(135deg, #e8f5ff, #dffbea);
  font-size: 46px;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.eyebrow.light {
  color: #bce0ff;
}

h1 {
  margin: 8px 0 0;
  font-size: clamp(38px, 7vw, 72px);
  line-height: .95;
}

h2 {
  margin: 10px 0 0;
  font-size: clamp(22px, 3vw, 34px);
}

h3 {
  margin: 5px 0 0;
}

.lead {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.feature-grid,
.final-grid {
  display: grid;
  gap: 14px;
  margin: 28px 0;
}

.feature-grid {
  grid-template-columns: repeat(4, 1fr);
}

.final-grid {
  grid-template-columns: repeat(3, 1fr);
}

.feature-grid div,
.final-grid div {
  padding: 18px;
  border-radius: 22px;
  background: var(--soft);
}

.feature-grid b,
.final-grid b {
  display: block;
  color: var(--green);
  font-size: 30px;
}

.feature-grid span,
.final-grid span {
  color: var(--muted);
  font-weight: 800;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn {
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 14px;
}

.btn.big {
  padding: 17px 26px;
  font-size: 17px;
}

.btn.small {
  padding: 9px 12px;
  font-size: 12px;
}

.btn.full {
  width: 100%;
  margin: 10px 0;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 14px 28px rgba(32,196,119,.25);
}

.secondary {
  color: #0b4f93;
  background: #dff1ff;
}

.ghost {
  color: #164d98;
  background: #edf6ff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  margin-bottom: 14px;
  color: white;
  background: rgba(255,255,255,.13);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(95px, 1fr));
  gap: 10px;
}

.stats div {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.16);
  text-align: center;
}

.stats span {
  display: block;
  font-size: 12px;
  opacity: .8;
}

.stats b {
  font-size: 20px;
}

.helper {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 20px;
  margin-bottom: 14px;
  border: 2px solid rgba(255,209,102,.65);
}

.helper-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: #fff2c4;
  font-size: 36px;
}

.helper h3,
.helper p {
  margin: 0;
}

.helper p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr .84fr .98fr;
  gap: 14px;
  align-items: start;
}

.game-card,
.side-card {
  padding: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.small-head {
  margin-bottom: 10px;
}

.client-queue {
  display: grid;
  gap: 10px;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
  border-radius: 20px;
  background: #10243f;
  color: white;
  border: 2px solid transparent;
}

.client-card.active {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255,209,102,.18);
}

.client-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 18px;
  background: rgba(255,255,255,.13);
  font-size: 30px;
}

.client-card b {
  display: block;
}

.client-card span {
  display: block;
  margin-top: 4px;
  color: #c6d7ee;
  font-size: 13px;
  line-height: 1.35;
}

.client-card small {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #16345a;
  background: #dff1ff;
  font-weight: 900;
  font-size: 11px;
}

.selected-client {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 15px;
  padding: 17px;
  border-radius: 22px;
  background: var(--soft);
}

.selected-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 21px;
  background: white;
  font-size: 36px;
}

.selected-client p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.department {
  min-height: 110px;
  padding: 15px;
  text-align: center;
  border-radius: 22px;
  background: var(--soft);
  color: var(--text);
  border: 2px solid transparent;
}

.department:hover {
  border-color: rgba(47,128,237,.35);
  box-shadow: 0 10px 22px rgba(47,128,237,.12);
}

.department.locked {
  opacity: .45;
}

.department .icon {
  display: block;
  font-size: 34px;
}

.department b {
  display: block;
  margin-top: 8px;
}

.department small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.feedback {
  margin-top: 14px;
  padding: 15px 16px;
  border-radius: 18px;
  font-weight: 900;
  line-height: 1.4;
}

.feedback.good {
  color: #08603e;
  background: #dffbea;
}

.feedback.bad {
  color: #8e1f29;
  background: #ffe1e5;
}

.feedback.warn {
  color: #6a4b00;
  background: #fff2c6;
}

.hidden {
  display: none !important;
}

.shop,
.bonus-shop {
  display: grid;
  gap: 10px;
}

.shop-item,
.bonus-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: var(--soft);
}

.bonus-item {
  background: linear-gradient(135deg, #f4f1ff, #edf6ff);
}

.shop-icon,
.bonus-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: white;
  font-size: 23px;
}

.shop-item h4,
.shop-item p,
.bonus-item h4,
.bonus-item p {
  margin: 0;
}

.shop-item p,
.bonus-item p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.buy {
  min-width: 72px;
  padding: 10px 12px;
  border-radius: 13px;
  color: white;
  background: var(--blue);
  font-size: 12px;
}

.buy.bought {
  background: var(--green);
}

.auto-box {
  padding: 14px;
  border-radius: 22px;
  background: #f7fbff;
  border: 2px solid #dbeafe;
}

.auto-card .auto-box {
  padding: 0;
  border: 0;
  background: transparent;
}

.auto-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.auto-stats div {
  padding: 10px;
  border-radius: 14px;
  background: white;
  text-align: center;
}

.auto-timer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auto-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.auto-stats b {
  display: block;
  color: var(--purple);
  font-size: 16px;
}

.auto-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.auto-progress span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.1s linear;
}

.auto-status {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  color: var(--blue);
  font-weight: 800;
  text-align: center;
}

.goal-box {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 22px;
  background: #fff8eb;
  border: 2px solid #fde68a;
}

.goal-list {
  display: grid;
  gap: 8px;
}

.goal-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.goal-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.goal-item b {
  color: var(--orange);
  font-size: 14px;
}

.simple-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 8, 18, .72);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  z-index: 29000;
}

.tutorial-overlay.active {
  display: flex;
}

.tutorial-card {
  position: fixed;
  top: 50%;
  left: 50%;
  display: none;
  width: min(640px, 95vw);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px 20px 16px;
  border: 2px solid rgba(255, 209, 102, .72);
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f0df, #efe2c9);
  color: #35240d;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  transform: translate(-50%, -50%);
  z-index: 30002;
  pointer-events: auto;
}

.tutorial-card.active {
  display: block;
}

.tutorial-card.pos-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.tutorial-card.pos-top-left {
  top: 10%;
  left: 6%;
  transform: none;
}

.tutorial-card.pos-top-right {
  top: 10%;
  right: 6%;
  left: auto;
  transform: none;
}

.tutorial-card.pos-bottom-left {
  bottom: 6%;
  left: 6%;
  top: auto;
  transform: none;
}

.tutorial-card.pos-bottom-right {
  right: 6%;
  bottom: 6%;
  left: auto;
  top: auto;
  transform: none;
}

.tutorial-step {
  margin-bottom: 8px;
  color: #986918;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tutorial-title {
  margin: 0 0 10px;
  color: #3f2808;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.02;
}

.tutorial-text {
  min-height: 92px;
  margin: 0;
  color: #5a4120;
  font-size: 22px;
  line-height: 1.35;
  white-space: pre-line;
}

.tutorial-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.tutorial-btn {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 11px;
  background: #9b6e1d;
  color: white;
  font-size: 14px;
}

.tutorial-focus {
  position: relative;
  z-index: 30001 !important;
  filter: brightness(1.08) saturate(1.12);
  box-shadow:
    0 0 0 3px rgba(255, 209, 102, .9),
    0 0 22px rgba(255, 209, 102, .62),
    0 0 42px rgba(255, 209, 102, .42) !important;
}

.client-card.tutorial-focus,
.department.tutorial-focus,
.goal-box.tutorial-focus,
.shop-item.tutorial-focus,
.bonus-item.tutorial-focus,
.helper.tutorial-focus {
  border-radius: 18px;
}

.tutorial-demo-client,
.tutorial-demo-department,
.tutorial-demo-shop,
.tutorial-demo-bonus {
  border-color: rgba(255, 209, 102, .95) !important;
  box-shadow: 0 0 0 4px rgba(255, 209, 102, .2), 0 14px 28px rgba(255, 209, 102, .24) !important;
}

@media (max-width: 900px) {
  .tutorial-card.pos-top-left,
  .tutorial-card.pos-top-right,
  .tutorial-card.pos-bottom-left,
  .tutorial-card.pos-bottom-right {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 1160px) {
  .main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .app {
    width: calc(100% - 18px);
    padding: 10px 0;
  }

  .start-card,
  .final-card,
  .topbar,
  .helper,
  .game-card,
  .side-card {
    padding: 16px;
    border-radius: 24px;
  }

  .topbar,
  .helper,
  .section-head,
  .selected-client {
    flex-direction: column;
    align-items: stretch;
  }

  .feature-grid,
  .final-grid,
  .department-grid,
  .main-grid,
  .stats,
  .auto-stats {
    grid-template-columns: 1fr;
  }

  .shop-item,
  .bonus-item {
    grid-template-columns: 42px 1fr;
  }

  .buy {
    grid-column: 1 / -1;
  }
}
