* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg: #070816;
  --surface: rgba(18, 21, 43, 0.94);
  --soft: rgba(31, 35, 67, 0.82);
  --border: rgba(167, 139, 250, 0.24);
  --primary: #7c3aed;
  --light: #a78bfa;
  --text: #f8fafc;
  --muted: #aeb6ca;
  --success: #55e6a5;
  --danger: #fb7185;
}
body {
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0, rgba(124, 58, 237, 0.24), transparent 32%),
    var(--bg);
}
body[dir="rtl"] {
  font-family: Arial, Tahoma, sans-serif;
}
button,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 13px max(18px, calc((100% - 1180px) / 2));
  background: rgba(7, 8, 22, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  font-size: 21px;
  font-weight: 900;
}
.brand span:last-child {
  display: grid;
  gap: 3px;
}
.brand strong {
  font-size: 20px;
}
.brand small {
  color: var(--muted);
}
.top-actions {
  display: flex;
  gap: 8px;
}
.top-actions button,
.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
}
.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: auto;
  padding-bottom: 60px;
}
.hero {
  padding: 58px 0 32px;
  text-align: center;
}
.eyebrow {
  display: inline-flex;
  padding: 8px 14px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.14);
  color: #ddd3ff;
  font-size: 13px;
  font-weight: 750;
}
.hero h1 {
  max-width: 900px;
  margin: 19px auto 0;
  font-size: clamp(37px, 6vw, 62px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.hero h1 span {
  color: var(--light);
}
body[dir="rtl"] .hero h1 {
  letter-spacing: 0;
  line-height: 1.25;
}
.hero p {
  max-width: 760px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}
.account-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 17px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.account-bar div {
  display: grid;
  gap: 5px;
}
.account-bar small,
.output-summary small,
.result-grid small {
  color: var(--muted);
}
.account-bar strong {
  font-size: 18px;
}
.credit {
  color: var(--light) !important;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 20px;
  align-items: start;
}
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}
.tool-panel {
  padding: 24px;
}
.panel h2 {
  font-size: 24px;
}
.panel-intro {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.dropzone {
  width: 100%;
  min-height: 210px;
  margin-top: 22px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 24px;
  border: 1.5px dashed rgba(167, 139, 250, 0.5);
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.08);
  color: var(--text);
  cursor: pointer;
}
.dropzone:hover,
.dropzone.dragging {
  border-color: var(--light);
  background: rgba(124, 58, 237, 0.15);
}
.drop-icon {
  font-size: 48px;
}
.dropzone strong {
  font-size: 17px;
}
.dropzone small {
  color: var(--muted);
}
.source-preview {
  display: none;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--soft);
}
.source-preview.show {
  display: grid;
}
.source-preview img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 12px;
  background: #fff;
}
.source-preview div {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.source-preview strong {
  overflow-wrap: anywhere;
}
.source-preview small {
  color: var(--muted);
}
.source-preview button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(251, 113, 133, 0.24);
  border-radius: 11px;
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger);
  cursor: pointer;
}
fieldset {
  margin-top: 22px;
  border: 0;
}
legend,
.field > span {
  margin-bottom: 10px;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 750;
}
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.mode-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
  cursor: pointer;
}
.mode-card.selected {
  border-color: var(--light);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.13);
}
.mode-card input {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
body[dir="rtl"] .mode-card input {
  right: auto;
  left: 15px;
}
.mode-icon {
  font-size: 30px;
}
.mode-card strong {
  font-size: 16px;
}
.mode-card small {
  color: var(--muted);
  line-height: 1.6;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 21px;
}
.field {
  display: grid;
}
.field select,
.field textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: rgba(8, 11, 27, 0.88);
  color: var(--text);
}
.field textarea {
  min-height: 94px;
  resize: vertical;
  line-height: 1.6;
}
.field select:focus,
.field textarea:focus {
  border-color: var(--light);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
.output-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(124, 58, 237, 0.12);
}
.output-summary div {
  display: grid;
  gap: 5px;
}
.primary-button {
  width: 100%;
  min-height: 58px;
  margin-top: 15px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(124, 58, 237, 0.26);
}
.primary-button:disabled {
  opacity: 0.58;
  cursor: wait;
}
.status {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  line-height: 1.6;
}
.status.show {
  display: block;
}
.status.loading {
  color: #ddd3ff;
  background: rgba(124, 58, 237, 0.15);
}
.status.success {
  color: var(--success);
  background: rgba(85, 230, 165, 0.1);
}
.status.warning {
  color: #ffd27a;
  background: rgba(245, 166, 35, 0.14);
}
.status.error {
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.12);
}
.result-card {
  display: none;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(85, 230, 165, 0.3);
  border-radius: 18px;
  background: rgba(18, 57, 52, 0.42);
}
.result-card.show {
  display: block;
}
.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.result-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-heading button,
.history-actions button {
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(124, 58, 237, 0.18);
  color: var(--text);
  cursor: pointer;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.result-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(8, 11, 27, 0.48);
}
.result-card p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.6;
}
.history-panel {
  overflow: hidden;
  padding: 22px;
}
.history-list {
  display: grid;
  gap: 10px;
  max-height: 780px;
  margin-top: 17px;
  overflow-y: auto;
}
.empty {
  padding: 32px 10px;
  color: var(--muted);
  text-align: center;
}
.history-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--soft);
}
.history-name {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.history-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}
.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}
.history-actions button {
  flex: 1;
}
.history-actions .delete {
  flex: 0 0 44px;
  color: var(--danger);
}
@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .history-list {
    max-height: none;
  }
}
@media (max-width: 620px) {
  .topbar {
    min-height: 70px;
    padding: 11px 14px;
  }
  .brand small,
  .back-button span:last-child {
    display: none;
  }
  .page-shell {
    width: min(100% - 26px, 1180px);
  }
  .hero {
    padding: 42px 0 25px;
  }
  .hero h1 {
    font-size: 37px;
  }
  .account-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .tool-panel {
    padding: 17px;
  }
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .output-summary,
  .result-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .dropzone {
    min-height: 180px;
  }
}
/* Design Unpack Ultimate controls */
.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field:last-child {
  grid-column: 1/-1;
}
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-top: 17px;
}
.check-card {
  display: flex;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--soft);
  cursor: pointer;
}
.check-card input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}
.check-card span {
  display: grid;
  gap: 5px;
}
.check-card small {
  color: var(--muted);
  line-height: 1.5;
}
.limitations-card {
  display: flex;
  gap: 13px;
  margin-top: 17px;
  padding: 16px;
  border: 1px solid rgba(251, 191, 36, 0.42);
  border-radius: 15px;
  background: rgba(120, 53, 15, 0.2);
  cursor: pointer;
}
.limitations-card input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #f59e0b;
}
.limitations-card span {
  display: grid;
  gap: 7px;
}
.limitations-card strong {
  color: #fde68a;
}
.limitations-card small {
  color: #e5e7eb;
  line-height: 1.65;
}
.feature-strip {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto 60px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.feature-strip article {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: var(--surface);
}
.feature-strip b {
  font-size: 28px;
}
.feature-strip span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 880px) {
  .feature-strip {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .field-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }
  .field:last-child {
    grid-column: auto;
  }
  .feature-strip {
    width: min(100% - 26px, 1180px);
  }
}
/* Comprehensive design-format controls */
.field input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: rgba(8, 11, 27, 0.88);
  color: var(--text);
}
.field > small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.field input:focus {
  border-color: var(--light);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
