/* Quiz Rush Deck Builder — static, dependency-free stylesheet. */

:root {
  --bg: #0b0e14;
  --bg-elevated: #121722;
  --bg-input: #0e131c;
  --bg-hover: #1a2230;
  --border: #232c3d;
  --border-strong: #33405a;
  --text: #e6ebf5;
  --text-muted: #93a0b8;
  --text-dim: #6b778c;
  --accent: #5b8cff;
  --accent-strong: #3d72f0;
  --accent-soft: rgba(91, 140, 255, 0.16);
  --success: #45d483;
  --success-soft: rgba(69, 212, 131, 0.14);
  --error: #ff6b81;
  --error-soft: rgba(255, 107, 129, 0.14);
  --warning: #f5b544;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --font: "Vazirmatn", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 20px 48px;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(91, 140, 255, 0.18), transparent 65%),
    radial-gradient(760px 420px at 92% 4%, rgba(69, 212, 131, 0.1), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, 100%);
  margin: 0 auto 20px;
}

.brand-group {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.app-logo {
  font-size: 40px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4.2vw, 40px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.subtitle {
  max-width: 620px;
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- step navigation bar ---------- */

.step-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: min(1180px, 100%);
  margin: 0 auto 24px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.step-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.step-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.step-nav-item.active {
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(61, 114, 240, 0.4);
}

.step-nav-item .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.step-nav-arrow {
  color: var(--text-dim);
  font-size: 15px;
  user-select: none;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  gap: 2px;
}

.lang-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(61, 114, 240, 0.35);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pill {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------- layout ---------- */

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.card-heading h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-heading p {
  margin: 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.card-heading code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.count-pill {
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #b9ccff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: #b9ccff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.view-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn:hover {
  color: var(--text);
}

.view-btn.active {
  background: var(--border-strong);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------- tools accordion ---------- */

.tools-accordion {
  margin-bottom: 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.tools-accordion[open] {
  border-color: var(--accent);
}

.tools-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s ease, color 0.15s ease;
}

.tools-summary::-webkit-details-marker {
  display: none;
}

.tools-summary:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.tools-summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tools-summary-icon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.tools-accordion[open] .tools-summary-icon {
  transform: rotate(180deg);
}

.tools-drawer-content {
  padding: 16px 18px 20px;
  border-top: 1px solid var(--border);
}

.tool-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-tab-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-tab-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tool-tab-btn.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(61, 114, 240, 0.35);
}

.tool-panel {
  display: none;
}

.tool-panel.active {
  display: block;
}

.tool-panel-header {
  margin-bottom: 14px;
}

.tool-panel-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
}

.tool-panel-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ---------- forms ---------- */

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.metadata-grid label,
.prompt-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #3f4e6d;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #101724;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

select option {
  background: var(--bg-elevated);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

#bulkText,
#importCode {
  font-family: var(--mono);
  font-size: 13px;
  tab-size: 4;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.08s ease, color 0.15s ease;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, #6b98ff, var(--accent-strong));
  color: #08101f;
}

.button.primary:hover {
  background: linear-gradient(180deg, #82a8ff, #4a80ff);
}

.button.secondary {
  border-color: var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
}

.button.secondary:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: #cfdcff;
}

.button:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
  border-color: var(--error);
  background: var(--error-soft);
  color: var(--error);
}

/* ---------- sheet table ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 -22px;
  padding: 0 22px 4px;
  scrollbar-color: var(--border-strong) transparent;
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-align: start;
  text-transform: uppercase;
  white-space: nowrap;
}

th.row-number,
td.row-number {
  width: 42px;
  min-width: 42px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

th.question-column {
  width: 32%;
  min-width: 260px;
}

th.correct-column,
td.correct-column {
  width: 84px;
  min-width: 84px;
  text-align: center;
}

th.delete-column,
td.delete-column {
  width: 46px;
  min-width: 46px;
  text-align: center;
}

tbody td {
  padding: 5px 5px;
  border-bottom: 1px solid rgba(35, 44, 61, 0.65);
  vertical-align: top;
}

tbody tr:hover td {
  background: rgba(26, 34, 48, 0.45);
}

tbody td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

tbody td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

#sheet td input,
#sheet td textarea,
#sheet td select {
  padding: 8px 9px;
  border-color: transparent;
  background: transparent;
  font-size: 14px;
}

#sheet td textarea {
  min-height: 58px;
  resize: vertical;
}

#sheet td input:hover,
#sheet td textarea:hover,
#sheet td select:hover {
  border-color: var(--border-strong);
  background: var(--bg-input);
}

#sheet td input:focus,
#sheet td textarea:focus,
#sheet td select:focus {
  border-color: var(--accent);
  background: #101724;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#sheet td.correct-column select {
  padding: 8px 4px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
}

/* ---------- card mode (friendly, spacious layout for parents) ---------- */

#sheet.card-mode {
  display: block;
  min-width: 0;
  width: 100%;
}

#sheet.card-mode thead {
  display: none;
}

#sheet.card-mode tbody {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

#sheet.card-mode tbody tr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "num del"
    "q q"
    "opt1 opt2"
    "opt3 opt4"
    "corr corr";
  gap: 12px;
  padding: 18px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

#sheet.card-mode tbody tr:hover {
  border-color: #3e5175;
}

#sheet.card-mode td {
  padding: 0;
  border: none;
  background: transparent !important;
}

#sheet.card-mode td.row-number {
  grid-area: num;
  text-align: start;
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  font-family: inherit;
  font-size: 15px;
  font-weight: 750;
  color: #b9ccff;
}

#sheet.card-mode td.row-number::before {
  content: "❓ ";
  margin-inline-end: 4px;
}

#sheet.card-mode td.delete-column {
  grid-area: del;
  text-align: end;
  width: auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

#sheet.card-mode td.delete-column .icon-button {
  width: 32px;
  height: 32px;
  font-size: 20px;
  border-radius: 8px;
}

#sheet.card-mode td.question-cell {
  grid-area: q;
}

#sheet.card-mode td.question-cell textarea {
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  line-height: 1.5;
}

#sheet.card-mode td.option-cell {
  position: relative;
}

#sheet.card-mode td.option-cell input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  transition: all 0.2s ease;
}

[dir="rtl"] #sheet.card-mode td.option-cell input {
  padding: 11px 40px 11px 14px;
}

#sheet.card-mode td.option-cell::before {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--border-strong);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  z-index: 1;
}

[dir="rtl"] #sheet.card-mode td.option-cell::before {
  left: auto;
  right: 12px;
}

#sheet.card-mode td.option-cell[data-option-idx="1"]::before { content: "A"; }
#sheet.card-mode td.option-cell[data-option-idx="2"]::before { content: "B"; }
#sheet.card-mode td.option-cell[data-option-idx="3"]::before { content: "C"; }
#sheet.card-mode td.option-cell[data-option-idx="4"]::before { content: "D"; }

[dir="rtl"] #sheet.card-mode td.option-cell[data-option-idx="1"]::before { content: "۱"; }
[dir="rtl"] #sheet.card-mode td.option-cell[data-option-idx="2"]::before { content: "۲"; }
[dir="rtl"] #sheet.card-mode td.option-cell[data-option-idx="3"]::before { content: "۳"; }
[dir="rtl"] #sheet.card-mode td.option-cell[data-option-idx="4"]::before { content: "۴"; }

/* Highlight winning answer choice */
#sheet.card-mode td.option-cell input.is-correct {
  border-color: #34d399 !important;
  background: rgba(52, 211, 153, 0.12) !important;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25) !important;
  color: #ffffff;
}

#sheet.card-mode td.option-cell.is-winner-choice::before {
  background: #34d399;
  color: #064e3b;
}

#sheet.card-mode td.correct-column {
  grid-area: corr;
  width: 100%;
}

#sheet.card-mode td.correct-column select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #34d399;
  background-color: var(--bg-elevated);
  color: #45d483;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-align: start;
}

[dir="rtl"] #sheet.card-mode td.correct-column select {
  text-align: right;
}

@media (max-width: 680px) {
  #sheet.card-mode tbody tr {
    grid-template-columns: 1fr;
    grid-template-areas:
      "num del"
      "q"
      "opt1"
      "opt2"
      "opt3"
      "opt4"
      "corr";
  }
}

/* validation state */

.invalid-row td {
  background: var(--error-soft);
}

.invalid-row td:first-child {
  box-shadow: inset 3px 0 0 var(--error);
}

input.invalid,
textarea.invalid,
select.invalid {
  border-color: var(--error) !important;
  background: rgba(255, 107, 129, 0.1) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 129, 0.16) !important;
}

/* ---------- actions + status ---------- */

.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.action-row-bottom {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.add-bottom-btn {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.status {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.status.error {
  color: var(--error);
}

.status.success {
  color: var(--success);
}

/* ---------- step 3 & ready banner ---------- */

.generate-cta {
  display: flex;
  justify-content: center;
  margin: 10px 0 16px;
}

.giant-btn {
  padding: 14px 34px;
  font-size: 16px;
  font-weight: 750;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(61, 114, 240, 0.4);
  letter-spacing: -0.01em;
}

.ready-banner {
  display: none;
  margin-top: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(91, 140, 255, 0.08), rgba(69, 212, 131, 0.08)), var(--bg-input);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  animation: bannerFadeIn 0.3s ease;
}

.ready-banner.visible {
  display: block;
}

@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ready-banner-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ready-icon {
  font-size: 36px;
  line-height: 1;
}

.ready-banner-header h3 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 750;
  color: #ffffff;
}

.ready-banner-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.big-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.copy-giant-btn {
  padding: 12px 28px;
  font-size: 15.5px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-success-state {
  background: linear-gradient(180deg, #45d483, #22c55e) !important;
  color: #064e3b !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.45) !important;
}

.phone-guide {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.phone-guide h4 {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.phone-guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.phone-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}

.phone-step-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.code-details {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.code-details-summary {
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  margin-bottom: 10px;
}

/* ---------- output ---------- */

.code-output {
  min-height: 100px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-all;
  color: #b9ccff;
}

.prompt-preview {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- info + footer ---------- */

.info-card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 650;
}

.info-card ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text-muted);
  font-size: 14px;
}

.info-card li {
  margin-bottom: 6px;
}

.info-card strong {
  color: var(--text);
  font-weight: 600;
}

.muted {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  width: min(1180px, 100%);
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
}

/* ---------- RTL Support (Persian) ---------- */

[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .step-nav-arrow {
  transform: rotate(180deg);
}

[dir="rtl"] th {
  text-align: right;
}

[dir="rtl"] th.row-number,
[dir="rtl"] td.row-number,
[dir="rtl"] th.correct-column,
[dir="rtl"] td.correct-column,
[dir="rtl"] th.delete-column,
[dir="rtl"] td.delete-column {
  text-align: center;
}

[dir="rtl"] tbody td:first-child {
  border-radius: 0 8px 8px 0;
}

[dir="rtl"] tbody td:last-child {
  border-radius: 8px 0 0 8px;
}

[dir="rtl"] select {
  padding-right: 12px;
  padding-left: 34px;
  background-position: 18px calc(50% - 2px), 13px calc(50% - 2px);
}

[dir="rtl"] ol {
  padding-left: 0;
  padding-right: 22px;
}

[dir="rtl"] .code-output,
[dir="rtl"] #importCode,
[dir="rtl"] .pill {
  direction: ltr;
  text-align: left;
}

[dir="rtl"] .header-actions {
  align-items: flex-start;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  body {
    padding: 20px 12px 36px;
    font-size: 15px;
  }

  .app-header {
    flex-direction: column;
    gap: 14px;
  }

  .header-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .card {
    padding: 16px;
  }

  .table-wrap {
    margin: 0 -16px;
    padding: 0 16px 4px;
  }

  .card-heading {
    margin-bottom: 14px;
  }

  .action-row .button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
