﻿.ap-list {
  display: grid;
  gap: 1rem;
}

.ap-card {
  border: 1px solid rgba(18,39,64,0.12);
  border-radius: 24px;
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(18,39,64,0.06);
}

.ap-card.correct {
  border-color: rgba(34,139,34,0.45);
  background: #f4fbf3;
}

.ap-card.incorrect {
  border-color: rgba(198,55,55,0.35);
  background: #fff4f4;
}

.ap-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.ap-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #e9f2fb;
  color: #14334f;
  font-size: 0.92rem;
}

.ap-source,
.ap-target {
  border-radius: 18px;
  padding: 0.95rem 1rem;
}

.ap-source {
  background: #f7fafc;
  margin-bottom: 0.9rem;
}

.ap-target.correct {
  background: #eef9ed;
}

.ap-target.incorrect {
  background: #fff3f3;
}

.ap-target.solution {
  background: #eef4ff;
}

.ap-target label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #14334f;
}

.ap-input {
  width: 100%;
  border: 2px solid rgba(20,51,79,0.15);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
}

.ap-input.correct {
  border-color: rgba(34,139,34,0.45);
  background: #eef9ed;
}

.ap-input.incorrect {
  border-color: rgba(198,55,55,0.35);
  background: #fff3f3;
  color: #a23939;
}

.ap-input.solution {
  border-color: rgba(40,89,166,0.35);
  background: #eef4ff;
  color: #2d65c7;
}

.ap-feedback {
  margin-top: 0.75rem;
  font-weight: 600;
}

.ap-feedback.ok {
  color: #1f7a1f;
}

.ap-feedback.error {
  color: #b13a3a;
}

.ap-click-hint {
  display: inline-block;
  margin-top: 0.35rem;
  color: #7f4a4a;
  font-size: 0.92rem;
}

.ap-solution {
  margin-top: 0.5rem;
  color: #2d65c7;
}

.ap-modal[hidden] {
  display: none !important;
}

.ap-modal {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ap-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,24,38,0.62);
}

.ap-modal-dialog {
  position: relative;
  width: min(980px, calc(100vw - 2rem));
  max-height: min(88vh, 980px);
  overflow-y: auto;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(8,24,39,0.24);
  padding: 1.4rem;
}

.ap-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.ap-modal-close {
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #14334f;
}

.ap-modal-summary {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  font-weight: 600;
}

.ap-modal-summary.ok {
  background: #eef9ed;
  color: #1f7a1f;
}

.ap-modal-summary.error {
  background: #fff1f1;
  color: #a23a3a;
}

.conditionals-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.conditionals-btn-primary,
.conditionals-btn-secondary,
.conditionals-actions button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  font: inherit;
  cursor: pointer;
}

.conditionals-btn-primary {
  background: #14334f;
  color: #fff;
}

.conditionals-btn-secondary,
.conditionals-actions button {
  background: #e9f2fb;
  color: #14334f;
}

@media (max-width: 860px) {
  .ap-guided-builder-head {
    grid-template-columns: 1fr;
  }

  .ap-builder-status-main,
  .ap-builder-status,
  .ap-builder-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ap-formula-grid,
  .ap-theory-layout,
  .ap-guided-example {
    grid-template-columns: 1fr;
  }

  .ap-time-table {
    overflow-x: auto;
  }

  .ap-time-row {
    min-width: 680px;
  }

  .ap-card-top,
  .ap-modal-header,
  .conditionals-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
.ap-theory-card {
  display: grid;
  gap: 1.25rem;
}

.ap-formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.ap-formula-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(20,51,79,0.12);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent 58%), #ffffff;
  padding: 1.2rem;
  box-shadow: 0 18px 36px rgba(18,39,64,0.06);
}

.ap-formula-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -46px;
  width: 130px;
  height: 130px;
  border-radius: 999px;
  background: rgba(59,130,246,0.08);
}

.ap-formula-label {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  margin-bottom: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: #14334f;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.ap-formula-card p {
  margin: 0 0 0.6rem;
  color: #14334f;
  font-size: 1.05rem;
}

.ap-formula-card em {
  position: relative;
  z-index: 1;
  display: block;
  color: #2d65c7;
  font-style: normal;
  font-weight: 800;
}

.ap-theory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.ap-time-table {
  overflow: hidden;
  border: 1px solid rgba(20,51,79,0.1);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(18,39,64,0.05);
}

.ap-time-row {
  display: grid;
  grid-template-columns: 0.85fr 1.2fr 1.2fr;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(20,51,79,0.08);
  color: #31485d;
}

.ap-time-row:last-child {
  border-bottom: 0;
}

.ap-time-row span:first-child {
  color: #14334f;
  font-weight: 800;
}

.ap-time-head {
  background: #14334f;
  color: #ffffff;
  font-weight: 800;
}

.ap-time-head span:first-child {
  color: #ffffff;
}

.ap-rule-box {
  border-radius: 24px;
  background: radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 42%), #f7fafc;
  padding: 1.2rem;
  border: 1px solid rgba(20,51,79,0.1);
}

.ap-rule-box h3 {
  margin: 0 0 0.75rem;
  color: #14334f;
}

.ap-rule-box ul {
  margin: 0;
  padding-left: 1.15rem;
  color: #31485d;
  line-height: 1.6;
}

.ap-guided-example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 1rem;
  align-items: center;
  border-radius: 26px;
  background: linear-gradient(135deg, #14334f, #1d4ed8);
  color: #ffffff;
  padding: 1.25rem;
  box-shadow: 0 22px 44px rgba(20,51,79,0.16);
}

.ap-guided-example .section-kicker,
.ap-guided-example h3,
.ap-guided-example p {
  color: #ffffff;
}

.ap-guided-example h3 {
  margin: 0.25rem 0 0.5rem;
}

.ap-guided-example p {
  margin: 0;
  font-weight: 800;
}

.ap-transform-steps {
  display: grid;
  gap: 0.55rem;
}

.ap-transform-steps span {
  display: block;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  padding: 0.7rem 0.8rem;
  color: #ffffff;
}
.ap-guided-builder {
  border: 1px solid rgba(20,51,79,0.1);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.1), transparent 34%),
    #ffffff;
  padding: clamp(1.2rem, 2.4vw, 1.8rem);
  box-shadow: 0 20px 40px rgba(18,39,64,0.06);
}

.ap-guided-builder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
  margin-bottom: 1.35rem;
}

.ap-guided-builder-copy {
  min-width: 0;
}

.ap-guided-builder-head h3,
.ap-guided-builder-head p {
  margin: 0;
}

.ap-guided-builder-head h3 {
  margin-top: 0.2rem;
  color: #14334f;
  font-size: clamp(1.25rem, 2.1vw, 1.65rem);
  line-height: 1.18;
}

.ap-guided-builder-head p:not(.section-kicker) {
  margin-top: 0.55rem;
  color: #64748b;
  line-height: 1.55;
}

.ap-builder-help {
  width: 100%;
  max-width: none;
  border-left: 4px solid rgba(59,130,246,0.34);
  padding: 0.7rem 0 0.7rem 0.9rem;
  background: rgba(239,246,255,0.72);
  border-radius: 0 16px 16px 0;
  overflow-wrap: normal;
  word-break: normal;
}

.ap-builder-counter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: #e9f2fb;
  color: #14334f;
  font-weight: 800;
}

.ap-builder-card {
  display: grid;
  gap: 1.15rem;
  border: 1px solid rgba(198,55,55,0.2);
  border-radius: 24px;
  background: rgba(255, 105, 105, 0.08);
  padding: clamp(1rem, 2vw, 1.35rem);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ap-builder-card.is-complete {
  border-color: rgba(34,139,34,0.28);
  background: rgba(73, 190, 96, 0.12);
  box-shadow: 0 16px 34px rgba(34,139,34,0.1);
}

.ap-builder-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  color: #14334f;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(20,51,79,0.08);
}

.ap-builder-status-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.ap-builder-status-main span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: #ffffff;
  color: #2d65c7;
  font-weight: 800;
}

.ap-builder-source {
  margin: 0;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  padding: 0.9rem 1rem;
  color: #14334f;
  font-size: 1.02rem;
  line-height: 1.55;
}

.ap-builder-slots,
.ap-builder-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ap-builder-slots {
  padding: 0.95rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.56);
  border: 1px dashed rgba(20,51,79,0.14);
}

.ap-builder-words {
  padding-top: 0.2rem;
}

.ap-builder-slot,
.ap-builder-word {
  min-height: 2.85rem;
  border-radius: 16px;
  padding: 0.72rem 1rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.ap-builder-slot {
  min-width: 150px;
  border: 2px dashed rgba(20,51,79,0.2);
  background: rgba(255,255,255,0.74);
  color: #64748b;
  text-align: center;
}

.ap-builder-slot.is-correct {
  border-style: solid;
  border-color: rgba(34,139,34,0.38);
  background: #eef9ed;
  color: #1f7a1f;
}

.ap-builder-slot.is-wrong {
  border-style: solid;
  border-color: rgba(198,55,55,0.35);
  background: #fff3f3;
  color: #a23939;
}

.ap-builder-word {
  border: 1px solid rgba(20,51,79,0.12);
  background: #ffffff;
  color: #14334f;
  box-shadow: 0 8px 18px rgba(18,39,64,0.06);
}

.ap-builder-word.is-selected {
  outline: 3px solid rgba(59,130,246,0.24);
  background: #eef4ff;
  color: #2d65c7;
}

.ap-builder-word.is-used {
  opacity: 0.35;
  cursor: not-allowed;
}

.ap-builder-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.35rem;
}

.ap-builder-next {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ap-theory-card,
.ap-formula-card,
.ap-rule-box,
.ap-guided-example,
.ap-guided-builder,
.ap-builder-card,
.ap-card,
.ap-source,
.ap-target,
.ap-modal-dialog {
  min-width: 0;
  max-width: 100%;
}

.ap-formula-card p,
.ap-rule-box,
.ap-time-row span,
.ap-builder-help,
.ap-builder-source,
.ap-builder-slot,
.ap-builder-word,
.ap-source,
.ap-target,
.ap-solution {
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .ap-formula-grid,
  .ap-theory-layout,
  .ap-guided-example,
  .ap-guided-builder-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .ap-builder-status-main,
  .ap-builder-status,
  .ap-builder-actions,
  .ap-card-top,
  .ap-modal-header,
  .conditionals-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ap-time-table {
    display: grid;
    gap: 0.75rem;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ap-time-head {
    display: none;
  }

  .ap-time-row {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    border: 1px solid rgba(20,51,79,0.1);
    border-radius: 18px;
    background: #ffffff;
    padding: 0.9rem;
    box-shadow: 0 12px 26px rgba(18,39,64,0.06);
  }

  .ap-time-row:last-child {
    border-bottom: 1px solid rgba(20,51,79,0.1);
  }

  .ap-time-row span:first-child {
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(20,51,79,0.08);
  }
}

@media (max-width: 620px) {
  .ap-card,
  .ap-guided-builder,
  .ap-builder-card,
  .ap-theory-card {
    border-radius: 20px;
    padding: 1rem;
  }

  .ap-builder-slots,
  .ap-builder-words {
    gap: 0.55rem;
  }

  .ap-builder-slot,
  .ap-builder-word {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
  }

  .ap-modal {
    align-items: stretch;
    padding: 0.55rem;
  }

  .ap-modal-dialog {
    width: 100%;
    max-height: calc(100dvh - 1.1rem);
    border-radius: 20px;
    padding: 1rem;
  }

  .ap-input {
    min-width: 0;
    font-size: 16px;
  }

  .conditionals-btn-primary,
  .conditionals-btn-secondary,
  .conditionals-actions button {
    width: 100%;
  }
}
