.iop-app,
.iop-app * {
  box-sizing: border-box;
}

.iop-app {
  min-height: 100dvh;
  background: #f1f5f9;
  color: #1e293b;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iop-left {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.iop-plan-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.iop-plan-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.2rem;
  line-height: 1.2;
}

.iop-plan-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.84rem;
}

.iop-scale {
  display: none;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 7px 10px;
}

.iop-plan-canvas {
  flex: 1;
  position: relative;
  background: #f8fafc;
  aspect-ratio: 4 / 3;
  max-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
}

.iop-plan-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.03));
}

.iop-dimension {
  pointer-events: none;
  fill: #64748b;
  font-size: 10px;
  font-family: Consolas, Monaco, monospace;
}

.iop-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.iop-list-header {
  padding: 0 4px;
  margin-bottom: 8px;
}

.iop-list-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 1.9rem;
  line-height: 1.15;
}

.iop-list-header p {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.45;
}

.iop-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  padding-bottom: 24px;
  overflow: visible;
}

.iop-card {
  position: relative;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.iop-card.is-hovered {
  border-color: #fdba74;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.iop-card.is-selected {
  border-color: #f97316;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.iop-card-selected-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: #f97316;
  border-radius: 12px 0 0 12px;
}

.iop-card-body {
  display: flex;
  gap: 14px;
}

.iop-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.iop-card-icon.is-selected {
  background: #ffedd5;
  color: #ea580c;
}

.iop-card-content {
  flex: 1;
}

.iop-card-title {
  margin: 0 0 4px;
  color: #1e293b;
  font-size: 1rem;
  font-weight: 700;
}

.iop-card-subtitle {
  margin: 0 0 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  font-weight: 700;
}

.iop-card-description {
  margin: 0;
  color: #64748b;
  font-size: 0.93rem;
  line-height: 1.45;
}

.iop-bonus {
  margin-top: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px 12px;
  display: none;
}

.iop-bonus.is-visible {
  display: block;
}

.iop-bonus-kicker {
  color: #9a3412;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.iop-bonus-text {
  color: #c2410c;
  font-size: 0.9rem;
  font-weight: 600;
}

.iop-card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.iop-card-footer.is-visible {
  display: flex;
}

.iop-quality {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

.iop-cta {
  border: 0;
  cursor: pointer;
  background: #ea580c;
  color: #ffffff;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.86rem;
  font-weight: 700;
  transition: background 0.25s ease;
}

.iop-cta:hover {
  background: #c2410c;
}

.iop-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
  z-index: 9999;
}

.iop-modal {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.25);
  padding: 22px;
  position: relative;
}

.iop-modal h3 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 1.36rem;
}

.iop-modal-selected {
  margin: 0 0 18px;
  color: #64748b;
  font-size: 0.92rem;
}

.iop-modal-selected span {
  color: #ea580c;
  font-weight: 700;
}

.iop-modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 0.85rem;
}

.iop-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iop-form label {
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
}

.iop-form input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  color: #0f172a;
}

.iop-form input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.iop-primary-btn,
.iop-secondary-btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.iop-primary-btn {
  margin-top: 8px;
  background: #ea580c;
  color: #ffffff;
}

.iop-primary-btn:hover {
  background: #c2410c;
}

.iop-primary-btn:disabled {
  background: #f97316;
  opacity: 0.7;
  cursor: not-allowed;
}

.iop-form-error {
  margin-top: 2px;
  margin-bottom: 4px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.84rem;
  line-height: 1.35;
  font-weight: 600;
}

.iop-secondary-btn {
  background: #f1f5f9;
  color: #1e293b;
}

.iop-secondary-btn:hover {
  background: #e2e8f0;
}

.iop-modal-success {
  text-align: center;
  padding: 12px 0 4px;
}

.iop-modal-check {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  margin: 0 auto 12px;
  background: #dcfce7;
  color: #16a34a;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iop-modal-success p {
  margin: 0 0 16px;
  color: #64748b;
}

@media (max-width: 639px) {
  .iop-modal-overlay {
    align-items: flex-end;
    justify-content: stretch;
    padding: 0;
  }

  .iop-modal {
    max-width: none;
    width: calc(100% - 8px);
    margin: 4px;
    border-radius: 16px 16px 10px 10px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .iop-modal h3 {
    font-size: 1.18rem;
    margin-bottom: 6px;
    padding-right: 34px;
    flex-shrink: 0;
  }

  .iop-modal-selected {
    margin-bottom: 12px;
    font-size: 0.88rem;
    flex-shrink: 0;
  }

  .iop-modal-close {
    width: 34px;
    height: 34px;
    right: 8px;
    top: 8px;
    font-size: 0.95rem;
  }

  .iop-form {
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .iop-form label {
    font-size: 0.86rem;
  }

  .iop-form input {
    padding: 11px 12px;
    font-size: 16px;
  }

  .iop-primary-btn,
  .iop-secondary-btn {
    padding: 12px;
    font-size: 0.92rem;
  }

  .iop-primary-btn {
    margin-top: 6px;
    position: sticky;
    bottom: 0;
    z-index: 3;
    box-shadow: 0 -8px 14px rgba(255, 255, 255, 0.95);
  }

  .iop-form-error {
    font-size: 0.8rem;
    padding: 7px 9px;
    margin-bottom: 2px;
  }

  .iop-modal-success {
    padding-top: 6px;
  }

  .iop-modal-check {
    width: 56px;
    height: 56px;
    margin-bottom: 10px;
  }

  .iop-modal-success p {
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.35;
  }
}

.iop-ping {
  transform-box: fill-box;
  transform-origin: center;
  animation: iop-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes iop-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@media (min-width: 640px) {
  .iop-scale {
    display: inline-flex;
    align-items: center;
  }

  .iop-plan-canvas {
    max-height: 60vh;
    padding: 12px;
  }
}

@media (min-width: 768px) {
  .iop-app {
    padding: 10px 16px;
    gap: 12px;
  }

  .iop-plan-header {
    padding: 12px 16px;
  }

  .iop-list-header {
    margin-bottom: 8px;
  }
}

@media (min-width: 1024px) {
  .iop-app {
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .iop-left {
    flex: 1;
    position: relative;
    top: auto;
    height: 100%;
    min-height: 0;
  }

  .iop-plan-canvas {
    max-height: none;
    padding: 2px 6px;
  }

  .iop-right {
    width: 400px;
    height: 100%;
    min-height: 0;
    background: #f8fafc;
    border-radius: 16px;
    padding: 10px 12px;
    overflow: hidden;
  }

  .iop-cards {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-right: 0;
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .iop-right.iop-fit-compact .iop-list-header {
    margin-bottom: 10px;
  }

  .iop-right.iop-fit-compact .iop-list-header h1 {
    font-size: 1.55rem;
  }

  .iop-right.iop-fit-compact .iop-list-header p {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .iop-right.iop-fit-compact .iop-cards {
    gap: 8px;
  }

  .iop-right.iop-fit-compact .iop-card {
    padding: 12px;
  }

  .iop-right.iop-fit-compact .iop-card-body {
    gap: 10px;
  }

  .iop-right.iop-fit-compact .iop-card-icon {
    width: 40px;
    height: 40px;
    font-size: 0.72rem;
  }

  .iop-right.iop-fit-compact .iop-card-title {
    margin-bottom: 2px;
    font-size: 0.94rem;
  }

  .iop-right.iop-fit-compact .iop-card-subtitle {
    margin-bottom: 6px;
    font-size: 0.63rem;
  }

  .iop-right.iop-fit-compact .iop-card-description {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .iop-right.iop-fit-compact .iop-bonus {
    margin-top: 8px;
    padding: 8px 10px;
  }

  .iop-right.iop-fit-compact .iop-bonus-kicker {
    font-size: 0.62rem;
  }

  .iop-right.iop-fit-compact .iop-bonus-text {
    font-size: 0.8rem;
  }

  .iop-right.iop-fit-compact .iop-card-footer {
    margin-top: 8px;
    padding-top: 8px;
    gap: 6px;
  }

  .iop-right.iop-fit-compact .iop-quality {
    font-size: 0.68rem;
  }

  .iop-right.iop-fit-compact .iop-cta {
    padding: 7px 10px;
    font-size: 0.74rem;
    border-radius: 7px;
  }

  .iop-right.iop-fit-tight .iop-list-header {
    margin-bottom: 8px;
  }

  .iop-right.iop-fit-tight .iop-list-header h1 {
    font-size: 1.35rem;
  }

  .iop-right.iop-fit-tight .iop-list-header p {
    margin-top: 4px;
    font-size: 0.75rem;
    line-height: 1.24;
  }

  .iop-right.iop-fit-tight .iop-cards {
    gap: 6px;
  }

  .iop-right.iop-fit-tight .iop-card {
    padding: 9px;
  }

  .iop-right.iop-fit-tight .iop-card-icon {
    width: 34px;
    height: 34px;
    font-size: 0.66rem;
  }

  .iop-right.iop-fit-tight .iop-card-subtitle {
    display: none;
  }

  .iop-right.iop-fit-tight .iop-card-description {
    font-size: 0.76rem;
    -webkit-line-clamp: 1;
  }

  .iop-right.iop-fit-tight .iop-bonus {
    margin-top: 6px;
    padding: 6px 8px;
  }

  .iop-right.iop-fit-tight .iop-bonus-text {
    font-size: 0.74rem;
  }

  .iop-right.iop-fit-tight .iop-card-footer {
    margin-top: 6px;
    padding-top: 6px;
  }

  .iop-right.iop-fit-tight .iop-quality {
    display: none;
  }

  .iop-right.iop-fit-tight .iop-cta {
    padding: 6px 8px;
    font-size: 0.68rem;
  }
}

@media (min-width: 1280px) {
  .iop-right {
    width: 450px;
  }
}

.iop-cards::-webkit-scrollbar {
  width: 6px;
}

.iop-cards::-webkit-scrollbar-track {
  background: transparent;
}

.iop-cards::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 20px;
}
