:root {
  --ivan-indigo: #5b51e5;
  --ivan-indigo-dark: #4038b7;
  --ivan-green: #20ad73;
  --ivan-ink: #172033;
  --ivan-muted: #68748a;
  --ivan-line: #e2e7ef;
  --ivan-soft: #f5f6fb;
}

body.ivan-daily-open {
  overflow: hidden !important;
}

.ivan-player-summary-wrap,
.ivan-admin-summary-wrap {
  width: 100%;
  margin: 16px 0;
}

.ivan-daily-summary {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  width: 100%;
  min-height: 148px;
  border: 1px solid rgba(91, 81, 229, 0.18);
  border-radius: 18px;
  padding: 20px;
  overflow: hidden;
  background: linear-gradient(145deg, #ffffff 0%, #f5f4ff 62%, #edf9f4 100%);
  box-shadow: 0 16px 38px rgba(28, 35, 61, 0.09);
  color: var(--ivan-ink);
  text-align: left;
  cursor: pointer;
}

.ivan-daily-summary::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -76px;
  top: -82px;
  border-radius: 50%;
  background: rgba(91, 81, 229, 0.11);
}

.ivan-daily-summary:focus-visible,
.ivan-plan-row:focus-visible,
.ivan-start-button:focus-visible,
.admin-pro-trainer-card[data-ivan-clickable]:focus-visible {
  outline: 3px solid rgba(91, 81, 229, 0.34);
  outline-offset: 3px;
}

.ivan-daily-kicker {
  grid-column: 1 / -1;
  color: var(--ivan-indigo-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ivan-daily-summary > strong {
  font-size: clamp(1.3rem, 4.8vw, 1.65rem);
  line-height: 1.06;
  font-weight: 950;
}

.ivan-daily-count {
  align-self: center;
  color: var(--ivan-indigo-dark);
  font-size: 1rem;
  font-weight: 950;
}

.ivan-daily-summary > i,
.ivan-progress-summary > i {
  grid-column: 1 / -1;
  display: block;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e3e6ee;
}

.ivan-daily-summary > i > span,
.ivan-progress-summary > i > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ivan-indigo), var(--ivan-green));
}

.ivan-daily-summary > small {
  grid-column: 1 / -1;
  color: var(--ivan-muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.ivan-admin-summary-wrap {
  padding: 0 24px;
}

.ivan-admin-summary-wrap .ivan-daily-summary {
  min-height: 132px;
  padding: 17px;
}

.admin-pro-trainer-card[data-ivan-clickable] {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.admin-pro-trainer-card[data-ivan-clickable]:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 81, 229, 0.35);
  box-shadow: 0 13px 28px rgba(28, 35, 61, 0.11);
}

.admin-pro-trainer-card[data-ivan-clickable]::after {
  content: "Открыть детали";
  display: block;
  margin-top: 11px;
  color: var(--ivan-indigo-dark);
  font-size: 0.74rem;
  font-weight: 900;
}

.ivan-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  align-items: end;
}

.ivan-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 25, 42, 0.56);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.ivan-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(92dvh, 920px);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  overflow: auto;
  background: #fff;
  box-shadow: 0 -22px 62px rgba(18, 25, 42, 0.24);
  animation: ivan-sheet-in 0.2s ease-out;
}

@keyframes ivan-sheet-in {
  from { transform: translateY(24px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.ivan-sheet-grip {
  flex: 0 0 auto;
  width: 48px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: #d8dde7;
}

.ivan-plan-head,
.ivan-sheet-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 4px 2px 14px;
}

.ivan-sheet-head {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.ivan-plan-head span,
.ivan-sheet-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--ivan-indigo-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ivan-plan-head h2,
.ivan-sheet-head h2 {
  margin: 0;
  color: var(--ivan-ink);
  font-size: clamp(1.42rem, 6vw, 1.85rem);
  line-height: 1.04;
  font-weight: 950;
}

.ivan-plan-head button,
.ivan-sheet-head button {
  min-height: 42px;
  border: 1px solid var(--ivan-line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--ivan-muted);
  font-size: 0.76rem;
  font-weight: 880;
}

.ivan-progress-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 14px;
  border: 1px solid rgba(91, 81, 229, 0.16);
  border-radius: 16px;
  padding: 15px;
  background: linear-gradient(135deg, #f4f3ff, #f0fbf6);
}

.ivan-progress-summary div {
  display: grid;
  gap: 2px;
}

.ivan-progress-summary div strong {
  color: var(--ivan-ink);
  font-size: 1.3rem;
  font-weight: 950;
}

.ivan-progress-summary div span {
  color: var(--ivan-muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.ivan-progress-summary > b {
  color: var(--ivan-green);
  font-size: 1.16rem;
  font-weight: 950;
}

.ivan-plan-rule {
  margin: 11px 2px;
  color: var(--ivan-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 680;
}

.ivan-plan-list,
.ivan-attempt-list {
  display: grid;
  gap: 9px;
}

.ivan-plan-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--ivan-line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  color: var(--ivan-ink);
  text-align: left;
  cursor: pointer;
}

.ivan-plan-row.is-done {
  border-color: rgba(32, 173, 115, 0.27);
  background: #f4fbf7;
}

.ivan-plan-row.has-retry {
  border-color: rgba(213, 66, 75, 0.32);
  background: #fff6f6;
}

.ivan-row-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #eceafd;
  color: var(--ivan-indigo-dark);
  font-size: 0.72rem;
  font-weight: 950;
}

.ivan-plan-row.is-done .ivan-row-mark {
  background: #ddf5e9;
  color: #087b4d;
}

.ivan-plan-row.has-retry .ivan-row-mark {
  background: #ffe1e3;
  color: #b4232d;
}

.ivan-row-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.ivan-row-copy strong {
  overflow: hidden;
  color: var(--ivan-ink);
  font-size: 0.92rem;
  line-height: 1.15;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ivan-row-copy small {
  overflow: hidden;
  color: var(--ivan-muted);
  font-size: 0.7rem;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ivan-row-attempts {
  display: flex;
  gap: 5px;
}

.ivan-row-attempts i {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #d8dde6;
  border-radius: 50%;
  background: #fff;
  color: #9aa3b2;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}

.ivan-row-attempts i.done {
  border-color: var(--ivan-green);
  background: var(--ivan-green);
  color: #fff;
}

.ivan-plan-row > b {
  min-width: 34px;
  color: var(--ivan-indigo-dark);
  font-size: 0.82rem;
  font-weight: 950;
  text-align: right;
}

.ivan-attempt {
  display: grid;
  gap: 12px;
  border: 1px solid var(--ivan-line);
  border-radius: 16px;
  padding: 15px;
  background: #fff;
}

.ivan-attempt.is-complete {
  border-color: rgba(32, 173, 115, 0.27);
  background: linear-gradient(145deg, #fff, #f4fbf7);
}

.ivan-attempt.is-failed {
  border-color: rgba(213, 66, 75, 0.38);
  background: linear-gradient(145deg, #fff, #fff1f2);
}

.ivan-attempt.is-interrupted,
.ivan-attempt.is-empty {
  background: #f7f8fb;
}

.ivan-attempt > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.ivan-attempt > header div {
  display: grid;
  gap: 3px;
}

.ivan-attempt > header span {
  color: var(--ivan-muted);
  font-size: 0.72rem;
  font-weight: 860;
  text-transform: uppercase;
}

.ivan-attempt > header strong {
  color: var(--ivan-ink);
  font-size: 0.95rem;
  font-weight: 930;
}

.ivan-attempt > header b {
  border-radius: 999px;
  padding: 6px 9px;
  background: #ddf5e9;
  color: #087b4d;
  font-size: 0.67rem;
  font-weight: 920;
}

.ivan-attempt.is-interrupted > header b,
.ivan-attempt.is-empty > header b {
  background: #e9ebf0;
  color: #6d7788;
}

.ivan-attempt.is-failed > header b {
  background: #ffe0e2;
  color: #ad202a;
}

.ivan-attempt.is-failed .ivan-attempt-metrics div:first-child strong,
.ivan-attempt.is-failed .ivan-attempt-progress {
  color: #c52f39;
}

.ivan-attempt-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.ivan-attempt-metrics div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid rgba(91, 81, 229, 0.1);
  border-radius: 11px;
  padding: 9px 6px;
  background: #fff;
  text-align: center;
}

.ivan-attempt-metrics span {
  color: var(--ivan-muted);
  font-size: 0.62rem;
  font-weight: 760;
}

.ivan-attempt-metrics strong {
  overflow: hidden;
  color: var(--ivan-ink);
  font-size: 0.91rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ivan-attempt-metrics div:nth-child(-n+3) strong {
  color: #07969d;
}

.ivan-attempt-metrics div:nth-child(4) strong {
  color: #d5424b;
}

.ivan-attempt-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ivan-attempt-settings span {
  border: 1px solid #dde2ea;
  border-radius: 999px;
  padding: 5px 8px;
  background: #fff;
  color: #596579;
  font-size: 0.67rem;
  font-weight: 760;
}

.ivan-attempt-progress {
  margin: 0;
  color: var(--ivan-green);
  font-size: 0.76rem;
  font-weight: 900;
}

.ivan-attempt.is-empty > p {
  margin: 0;
  color: var(--ivan-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.ivan-start-button {
  flex: 0 0 auto;
  width: 100%;
  min-height: 54px;
  margin-top: 13px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(100deg, #0aafb8, #7540e5);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(91, 81, 229, 0.23);
}

.ivan-admin-hint {
  margin: 13px 0 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: #f2f3f7;
  color: var(--ivan-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 700;
}

@media (min-width: 721px) {
  .ivan-modal {
    align-items: center;
    padding: 28px;
  }

  .ivan-sheet {
    max-height: min(88vh, 880px);
    border-radius: 24px;
    padding: 12px 20px 22px;
  }
}

@media (max-width: 430px) {
  .ivan-player-summary-wrap {
    margin: 12px 0 14px;
  }

  .ivan-daily-summary {
    min-height: 132px;
    border-radius: 16px;
    padding: 16px;
  }

  .ivan-admin-summary-wrap {
    padding: 0 12px;
  }

  .ivan-sheet {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .ivan-plan-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    min-height: 66px;
    gap: 8px;
    padding: 9px;
  }

  .ivan-row-mark {
    width: 40px;
    height: 40px;
  }

  .ivan-row-attempts {
    grid-column: 2;
    justify-self: start;
  }

  .ivan-plan-row > b {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .ivan-row-copy small {
    max-width: 48vw;
  }

  .ivan-attempt-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ivan-attempt-metrics div {
    padding: 10px 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ivan-sheet { animation: none; }
  .admin-pro-trainer-card[data-ivan-clickable] { transition: none; }
}
