:root {
  --page-bg: #f7f5ef;
  --surface: #ffffff;
  --text: #111111;
  --muted: #666666;
  --border: #dddddd;
  --brand-green: #8e9b7d;
  --selection: #383b71;
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page-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 {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
}

.modal-content,
.size-card {
  width: 90%;
  max-width: 600px;
  height: auto;
  position: relative;
  padding: 28px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.page-header {
  text-align: center;
}

.brand {
  display: inline-block;
  margin-bottom: 18px;
  color: black;
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-green);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.25;
}

.intro {
  max-width: 500px;
  margin: 12px auto 0;
  color: var(--muted);
  line-height: 1.8;
}

.size-questionnaire {
  padding: 25px 0 20px;
  text-align: right;
}

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

.question-group {
  margin-bottom: 20px;
}

.question-group label,
.question-group legend {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
}

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

.input-wrap {
  position: relative;
}

.question-group input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px 8px 54px;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  direction: rtl;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-group input[type="text"]:focus {
  border-color: var(--selection);
  box-shadow: 0 0 0 3px rgba(56, 59, 113, 0.12);
}

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

.question-group small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.body-type-options {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.body-type-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 2px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  flex-direction: column;
}

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

.body-type-btn.selected {
  border-color: var(--selection);
  background: #f8f8fb;
}

.body-type-btn span {
  display: block;
  text-align: center;
}

.option-title {
  font-weight: 700;
}

.option-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.body-type-btn > img {
  display: none !important;
}

.form-error {
  min-height: 24px;
  margin: 0 0 10px;
  color: #a32929;
  font-weight: 600;
}

.submit-btn,
.start-over-btn,
.shop-btn {
  width: 100%;
  min-height: 50px;
  padding: 12px;
  border: none;
  border-radius: 29px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
}

.submit-btn,
.start-over-btn {
  color: black;
  background: var(--brand-green);
}

.submit-btn:hover,
.start-over-btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.shop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: black;
  background: #f7f5ef;
  border: 1px solid #3f3f3f;
}

.shop-btn:hover {
  background: #efede6;
}

#sizeResult {
  text-align: center;
}

#sizeResult[hidden] {
  display: none;
}

.result-kicker {
  margin: 0;
  color: var(--brand-green);
  font-weight: 700;
}

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

.fabric-result {
  padding: 18px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.fabric-label {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.size-recommendation {
  margin: 20px 0;
  font-size: 24px;
  font-weight: bold;
}

.size-recommendation-main {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.7rem;
  font-weight: bold;
  direction: ltr;
}

.size-recommendation-note {
  display: block;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.golden-guarantee {
  margin: 18px 0 22px;
  padding: 12px 14px;
  color: #4d4d4d;
  background: #f7f5ef;
  border-radius: 8px;
  line-height: 1.7;
}

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

@media (max-width: 640px) {
  .page-shell {
    align-items: flex-start;
    padding: 0;
  }

  .modal-content,
  .size-card {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: 24px 18px;
    border-radius: 0;
    box-shadow: none;
  }

  .question-grid,
  .fabric-results,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .body-type-options {
    flex-direction: column;
  }

  .body-type-btn {
    width: 100%;
    padding: 13px 10px;
  }
}
