:root {
  --bg: #f4efe7;
  --surface: #fffdf9;
  --surface-alt: #f7f1e8;
  --text: #25221f;
  --muted: #746d65;
  --border: #ded3c5;
  --primary: #24211e;
  --primary-hover: #3a3530;
  --accent: #c8a56a;
  --error: #a62b2b;
  --shadow: 0 20px 60px rgba(51, 42, 32, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(200, 165, 106, 0.2), transparent 32rem),
    var(--bg);
  font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.size-card {
  width: min(100%, 760px);
  padding: clamp(24px, 5vw, 52px);
  background: var(--surface);
  border: 1px solid rgba(222, 211, 197, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.page-header {
  margin-bottom: 36px;
  text-align: center;
}

.brand {
  display: inline-block;
  margin-bottom: 26px;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.04em;
}

.eyebrow,
.result-kicker {
  margin: 0 0 8px;
  color: #8c6c3f;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 580px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.9;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.question-group {
  margin: 0 0 28px;
}

.question-group label,
.question-group legend {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 700;
}

fieldset.question-group {
  padding: 0;
  border: 0;
}

.input-wrap {
  position: relative;
}

input[type="text"] {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px 12px 62px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  direction: rtl;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 33, 30, 0.08);
}

.input-unit {
  position: absolute;
  top: 50%;
  left: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.body-type-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.body-type-btn {
  min-height: 116px;
  padding: 18px 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: right;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.body-type-btn:hover {
  transform: translateY(-2px);
  border-color: #a99a88;
}

.body-type-btn.selected {
  background: var(--surface-alt);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.option-title,
.option-description {
  display: block;
}

.option-title {
  margin-bottom: 6px;
  font-weight: 700;
}

.option-description {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.form-error {
  min-height: 26px;
  margin: -10px 0 10px;
  color: var(--error);
  font-weight: 600;
}

.primary-btn,
.secondary-btn {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-btn {
  width: 100%;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.secondary-btn {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.result-panel {
  text-align: center;
}

.result-panel[hidden] {
  display: none;
}

.fabric-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.fabric-result {
  padding: 26px 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.fabric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 600;
}

.size-recommendation-main {
  display: block;
  color: var(--text);
  font-size: clamp(2rem, 8vw, 3.4rem);
  font-weight: 700;
  direction: ltr;
}

.size-recommendation-note {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.golden-guarantee {
  margin: 20px 0 28px;
  padding: 14px 18px;
  color: #70542d;
  background: #f8ecd9;
  border: 1px solid #ead3ad;
  border-radius: var(--radius-sm);
  line-height: 1.7;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.shop-btn {
  width: auto;
}

@media (max-width: 680px) {
  .page-shell {
    display: block;
    padding: 0;
  }

  .size-card {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .question-grid,
  .body-type-options,
  .fabric-results {
    grid-template-columns: 1fr;
  }

  .body-type-btn {
    min-height: auto;
  }
}

@media (max-width: 430px) {
  .size-card {
    padding: 24px 18px 30px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}
