:root {
  --wine: #7d1734;
  --red: #b72249;
  --coral: #d94a67;
  --rose: #e889a0;
  --pink: #f5cbd6;
  --blush: #fbe9ee;
  --soft: #fff2f5;
  --paper: #ffffff;
  --ink: #3f202a;
  --muted: #765e66;
  --line: #ead9df;
  --green: #2c765f;
  --green-bg: #e7f3ee;
  --amber: #8a5a16;
  --amber-bg: #fff2d8;
  --blue: #315f75;
  --blue-bg: #e9f2f6;
  --shadow: 0 14px 40px rgba(93, 24, 48, 0.10);
  --shadow-soft: 0 5px 18px rgba(93, 24, 48, 0.08);
  --radius: 22px;
  --focus: 0 0 0 4px rgba(183, 34, 73, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 92% 3%, rgba(232, 137, 160, 0.20), transparent 28rem),
    radial-gradient(circle at -4% 96%, rgba(245, 203, 214, 0.35), transparent 26rem),
    var(--soft);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: var(--focus); }
a { color: inherit; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--wine); font-weight: 800; letter-spacing: .01em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--blush); display: grid; place-items: center; color: var(--red); font-weight: 900; font-size: 18px; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.area-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red); background: var(--blush); border-radius: 999px; padding: 9px 14px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.btn { border: 1px solid transparent; border-radius: 16px; min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; color: var(--red); background: var(--paper); transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(0); }
.btn-primary { color: var(--paper); background: var(--red); }
.btn-primary:hover { background: var(--wine); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-soft { background: var(--blush); border-color: transparent; }
.btn-danger { color: #8b1c3f; background: #fff0f3; border-color: #f2c9d4; }
.btn-wide { width: 100%; }
.btn-small { min-height: 38px; padding: 0 13px; border-radius: 12px; font-size: 13px; }

.content-wrap { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 56px; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 26px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 900; color: var(--red); margin-bottom: 9px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.08; margin-bottom: 8px; color: var(--wine); letter-spacing: -.02em; }
h2 { font-size: clamp(22px, 2.1vw, 30px); line-height: 1.15; margin-bottom: 8px; color: var(--wine); }
h3 { font-size: 18px; line-height: 1.2; margin-bottom: 7px; color: var(--wine); }
.lead { color: var(--muted); max-width: 710px; line-height: 1.55; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted); line-height: 1.45; }

.welcome { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.welcome-card { width: min(980px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 1.1fr .9fr; }
.welcome-copy { padding: clamp(34px, 6vw, 76px); background: linear-gradient(135deg, var(--paper), #fff1f5); }
.welcome-copy .brand { margin-bottom: 58px; }
.welcome-copy h1 { font-size: clamp(42px, 6vw, 72px); max-width: 580px; }
.welcome-copy .subline { font-size: 19px; color: var(--muted); line-height: 1.5; max-width: 480px; }
.trail-line { height: 84px; margin: 34px 0 0; position: relative; max-width: 470px; }
.trail-line::before { content: ""; position: absolute; left: 10px; right: 10px; top: 40px; height: 3px; background: var(--pink); transform: rotate(-7deg); transform-origin: center; }
.trail-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); position: absolute; top: 34px; }
.trail-dot:nth-child(1) { left: 3%; } .trail-dot:nth-child(2) { left: 28%; top: 28px; background: var(--rose); } .trail-dot:nth-child(3) { left: 56%; top: 45px; background: var(--coral); } .trail-dot:nth-child(4) { left: 85%; top: 30px; background: var(--wine); }
.welcome-choices { padding: 44px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.welcome-choices h2 { margin-bottom: 2px; }
.profile-btn { display: flex; align-items: center; gap: 15px; text-align: left; width: 100%; min-height: 88px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink); }
.profile-btn:hover { border-color: var(--rose); background: var(--blush); }
.profile-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--blush); color: var(--red); font-weight: 900; font-size: 21px; flex: 0 0 auto; }
.profile-btn strong { display: block; color: var(--wine); font-size: 17px; margin-bottom: 4px; }
.profile-btn span { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.privacy-note { margin-top: 14px; border-radius: 15px; background: var(--soft); padding: 14px 16px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.app-layout { display: flex; min-height: calc(100vh - 72px); }
.side-nav { width: 245px; flex: 0 0 245px; background: var(--wine); color: #fff; padding: 24px 15px; display: flex; flex-direction: column; }
.side-nav .brand { color: #fff; padding: 0 11px 25px; }
.side-nav .brand-mark { background: var(--red); color: #fff; }
.nav-section { color: #ecc8d3; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: 10px 14px; }
.nav-link { width: 100%; background: transparent; border: 0; color: #f4dfe5; min-height: 46px; padding: 0 14px; border-radius: 13px; display: flex; align-items: center; gap: 11px; text-align: left; font-size: 14px; margin-bottom: 3px; }
.nav-link:hover, .nav-link.active { background: #a92a4b; color: #fff; }
.nav-icon { width: 22px; text-align: center; opacity: .95; }
.side-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.18); padding: 18px 14px 4px; color: #e8c8d1; font-size: 12px; line-height: 1.45; }
.main { min-width: 0; flex: 1; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 22px; }
.panel-flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.space-between { justify-content: space-between; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

.stat { padding: 18px; border-radius: 17px; background: var(--paper); border: 1px solid var(--line); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 800; margin-bottom: 8px; }
.stat-value { font-size: 27px; color: var(--wine); font-weight: 900; letter-spacing: -.03em; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 5px; }

.mission-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px; min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.mission-card:hover { transform: translateY(-2px); border-color: var(--rose); box-shadow: var(--shadow-soft); }
.mission-card.locked { background: #fffafd; opacity: .78; }
.mission-number { width: 38px; height: 38px; border-radius: 13px; background: var(--blush); color: var(--red); display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.mission-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mission-card h3 { margin: 14px 0 6px; }
.mission-card p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0; }
.status { display: inline-flex; width: fit-content; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.status.available { background: var(--blue-bg); color: var(--blue); }
.status.progress { background: var(--amber-bg); color: var(--amber); }
.status.done { background: var(--green-bg); color: var(--green); }
.status.paused { background: var(--blush); color: var(--red); }
.status.optional { background: var(--soft); color: var(--muted); }
.status.draft { background: var(--amber-bg); color: var(--amber); }
.status.review { background: var(--blue-bg); color: var(--blue); }
.status.archived { background: var(--soft); color: var(--muted); }

.energy-option { border: 1px solid var(--line); background: var(--paper); padding: 15px 16px; border-radius: 17px; display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; }
.energy-option:hover, .energy-option.selected { border-color: var(--red); background: var(--blush); box-shadow: 0 0 0 2px rgba(183, 34, 73, .12); }
.energy-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--pink); display: grid; place-items: center; color: var(--wine); font-weight: 900; flex: 0 0 auto; }
.energy-option strong { color: var(--wine); display: block; font-size: 14px; margin-bottom: 3px; }
.energy-option span { font-size: 12px; color: var(--muted); }

.checklist { display: grid; gap: 9px; }
.check-row { min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: center; gap: 10px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--red); }
.check-row label { font-size: 14px; font-weight: 700; }

.strategy-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
.strategy-step { border-radius: 12px; background: var(--soft); border: 1px solid var(--line); padding: 12px 8px; text-align: center; }
.strategy-step b { display: block; font-size: 12px; color: var(--red); margin-bottom: 4px; }
.strategy-step span { font-size: 11px; color: var(--muted); }

.session-shell { max-width: 1020px; margin: 0 auto; }
.session-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.progress-track { height: 10px; border-radius: 999px; background: var(--blush); overflow: hidden; margin: 15px 0 22px; }
.progress-fill { height: 100%; background: var(--red); border-radius: inherit; transition: width .25s ease; }
.timer { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 10px 14px; font-weight: 900; font-size: 13px; }
.step-kind { color: var(--red); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; font-weight: 900; }
.step-instruction { color: var(--wine); font-size: clamp(22px, 3vw, 33px); line-height: 1.17; margin: 12px 0 9px; }
.step-body { color: var(--muted); font-size: 16px; line-height: 1.6; }
.session-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--line); }
.session-footer .left-actions, .session-footer .right-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.help-panel { border: 2px solid var(--red); background: var(--blush); }
.help-step { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 15px; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; }
.help-step:hover, .help-step.current { border-color: var(--red); background: var(--blush); }
.help-num { width: 30px; height: 30px; border-radius: 50%; background: var(--pink); display: grid; place-items: center; color: var(--wine); font-weight: 900; flex: 0 0 auto; }
.help-step.current .help-num { color: var(--paper); background: var(--red); }
.help-step strong { color: var(--ink); font-size: 14px; }

.number-grid { display: grid; grid-template-columns: repeat(4, minmax(70px, 1fr)); gap: 12px; max-width: 560px; }
.number-cell { min-height: 70px; border-radius: 16px; border: 2px solid var(--pink); background: var(--paper); color: var(--ink); font-size: 22px; font-weight: 900; }
.number-cell.selected { background: var(--red); color: var(--paper); border-color: var(--red); }
.sequence-list { display: grid; gap: 10px; max-width: 720px; }
.sequence-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--paper); padding: 14px; border-radius: 15px; }
.sequence-item button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--pink); background: var(--soft); color: var(--red); font-weight: 900; }
.sequence-item strong { flex: 1; font-size: 15px; }
.sequence-position { width: 28px; height: 28px; display: grid; place-items: center; background: var(--blush); color: var(--red); border-radius: 9px; font-size: 12px; font-weight: 900; }
.memory-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 560px; }
.memory-cell { min-height: 90px; border: 2px solid var(--pink); background: var(--paper); border-radius: 15px; display: grid; place-items: center; color: var(--red); font-weight: 900; font-size: 15px; }
.memory-cell.hidden { color: transparent; background: var(--soft); }
.route-board { display: grid; grid-template-columns: repeat(4, 70px); gap: 7px; margin: 14px 0; }
.route-cell { height: 60px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.route-cell.obstacle { background: var(--blush); color: var(--red); }
.route-cell.start { background: var(--green-bg); color: var(--green); }
.route-cell.end { background: var(--amber-bg); color: var(--amber); }
.response-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { display: grid; gap: 7px; }
.form-group label { color: var(--muted); font-size: 13px; font-weight: 800; }
.field, .form-group input, .form-group textarea, .form-group select { width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; background: var(--paper); color: var(--ink); }
.form-group textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.field:focus, .form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--red); outline: none; box-shadow: var(--focus); }
.choice-row { display: flex; flex-wrap: wrap; gap: 9px; }
.choice { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 10px 14px; font-size: 13px; font-weight: 800; }
.choice.selected { background: var(--red); border-color: var(--red); color: var(--paper); }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--blue-bg); color: var(--blue); font-size: 13px; line-height: 1.5; }
.notice.success { background: var(--green-bg); color: var(--green); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }

.timeline { position: relative; display: grid; gap: 0; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 3px; background: var(--pink); }
.timeline-event { position: relative; padding: 10px 0 10px 18px; display: grid; grid-template-columns: 52px 1fr; gap: 12px; font-size: 13px; }
.timeline-event::before { content: ""; position: absolute; left: 0; top: 16px; width: 15px; height: 15px; border-radius: 50%; background: var(--red); border: 3px solid var(--blush); }
.timeline-event time { color: var(--red); font-weight: 900; }
.timeline-event span { color: var(--ink); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 11px 10px; border-bottom: 1px solid var(--line); }
td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.admin-editor { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 16px; }
.block-library, .block-canvas, .block-properties { min-width: 0; }
.block-library { display: grid; gap: 7px; align-content: start; }
.block-type { text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color: var(--ink); font-size: 13px; }
.block-type:hover { border-color: var(--red); background: var(--blush); }
.block-item { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); padding: 16px; display: grid; gap: 8px; }
.block-item.selected { border: 2px solid var(--red); background: #fff9fb; }
.block-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.block-item-head strong { color: var(--wine); font-size: 14px; }
.block-tag { color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.block-actions { display: flex; gap: 5px; }
.icon-btn { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); color: var(--red); background: var(--paper); }
.icon-btn:hover { background: var(--blush); }
.properties-card { display: grid; gap: 13px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(63, 32, 42, .38); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { width: min(520px, 100%); background: var(--paper); border-radius: 24px; box-shadow: var(--shadow); padding: 24px; }
.modal h2 { margin-bottom: 7px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
.pin-input { letter-spacing: .35em; text-align: center; font-size: 28px; font-weight: 900; }

.empty { text-align: center; padding: 40px 18px; color: var(--muted); }
.achievement { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--soft); border: 1px solid var(--line); }
.achievement-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 900; flex: 0 0 auto; }
.achievement strong { color: var(--wine); display: block; margin-bottom: 4px; }
.achievement span { color: var(--muted); font-size: 13px; line-height: 1.4; }

@media (max-width: 1080px) {
  .admin-editor { grid-template-columns: 210px minmax(0, 1fr); }
  .block-properties { grid-column: 1 / -1; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .app-layout { display: block; }
  .side-nav { width: 100%; padding: 12px 12px 10px; position: sticky; top: 72px; z-index: 15; flex-direction: row; align-items: center; gap: 5px; overflow-x: auto; }
  .side-nav .brand, .nav-section, .side-footer { display: none; }
  .nav-link { width: auto; flex: 0 0 auto; min-height: 40px; padding: 0 12px; font-size: 12px; }
  .nav-icon { display: none; }
  .content-wrap { width: min(100% - 28px, 700px); padding-top: 24px; }
  .welcome-card { grid-template-columns: 1fr; }
  .welcome-copy { padding: 34px 28px 24px; }
  .welcome-copy .brand { margin-bottom: 36px; }
  .welcome-choices { padding: 28px; }
  .page-head { display: grid; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .response-grid { grid-template-columns: 1fr; }
  .session-top { display: grid; }
  .session-footer { display: grid; }
  .session-footer .left-actions, .session-footer .right-actions { width: 100%; }
  .session-footer .btn { flex: 1; }
  .admin-editor { grid-template-columns: 1fr; }
  .block-properties { grid-column: auto; }
}
@media (max-width: 520px) {
  .area-label { display: none; }
  .top-actions .btn { min-height: 38px; padding: 0 11px; font-size: 12px; }
  .strategy-strip { grid-template-columns: repeat(2, 1fr); }
  .number-grid { grid-template-columns: repeat(3, minmax(60px, 1fr)); gap: 8px; }
  .number-cell { min-height: 60px; }
  .route-board { grid-template-columns: repeat(4, 1fr); }
  .route-cell { height: 52px; }
  .grid-4 { grid-template-columns: 1fr; }
}
