/* KulliQ — the GPA calculator: a page for students on their phones first (big tap targets, the result always in view) */
.gpaPage { background: radial-gradient(900px 420px at 50% -120px, #e3f4ed, transparent 70%), var(--bg); }

/* the bar: KulliQ's mark, the title, the settings */
.gTop { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px max(16px, calc(50vw - 360px));
  padding-top: max(10px, env(safe-area-inset-top)); background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.gBrand { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; font-weight: 800; font-family: "Segoe UI", var(--font); }
.gBrand svg { width: 32px; height: 32px; }
.gBrand b { color: var(--primary); }
.gTitle { font-size: 1rem; color: var(--muted); font-weight: 600; padding-inline-start: 10px; border-inline-start: 1px solid var(--line); }
.gSetBtn { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: .45rem .75rem; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.gSetBtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.gSetBtn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.gWrap { width: min(720px, calc(100% - 28px)); margin: 0 auto; padding-bottom: 30px; }
.gHero { padding: 18px 0 8px; text-align: center; }
.gHero h1 { margin: 0 0 4px; font-size: clamp(1.5rem, 5.6vw, 2.1rem); line-height: 1.25; }
.uniLine { margin: 0 0 10px; color: var(--muted); font-size: .98rem; }
.uniLine b { color: var(--ink); }
.uniRow { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.scaleTag { background: var(--primary); color: #fff; border-radius: 99px; padding: .32rem .9rem; font-weight: 700; font-size: .9rem; }
.uniChip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .35rem .5rem .35rem .9rem;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink); cursor: pointer; max-width: 100%; }
.uniChip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uniChip i { font-style: normal; font-size: .8rem; color: var(--primary); background: var(--primary-soft); border-radius: 99px; padding: .1rem .6rem; flex: none; }
.gSettings { margin: 12px auto 0; max-width: 520px; display: grid; gap: 10px; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.setRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--muted); }
.setRow select { width: auto; max-width: 64%; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex: none; }
.seg button { border: 0; background: transparent; padding: .42rem .9rem; border-radius: 9px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--primary); color: #fff; }

/* the result: the ring, the rating, the two averages and «شارك معدلك» */
.gResult { --band: linear-gradient(135deg, #5d6e6a, #3e4b48); margin: 12px 0 14px; display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 24px;
  color: #fff; background: var(--band); box-shadow: 0 14px 34px rgba(20, 50, 45, .2); transition: background .35s ease; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: rgba(255, 255, 255, .22); }
.ring .val { stroke: #fff; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .6s ease; }
.ringTxt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ringTxt b { font-size: 2.15rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ringTxt small { font-size: .74rem; opacity: .9; }
.ringTxt .rOf { font-size: .82rem; font-weight: 700; opacity: 1; margin-bottom: 1px; }
.rSide { flex: 1; min-width: 0; display: grid; gap: 10px; }
.rRate { justify-self: start; background: rgba(255, 255, 255, .2); border-radius: 99px; padding: .28rem .9rem; font-weight: 700; font-size: .95rem; }
.rStats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rStats div { background: rgba(255, 255, 255, .13); border-radius: 12px; padding: 6px 8px; }
.rStats small { display: block; font-size: .72rem; opacity: .9; }
.rStats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.shareBtn { justify-self: start; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 12px; padding: .55rem 1rem; font: inherit; font-weight: 700;
  background: #fff; color: #0F6E56; cursor: pointer; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.shareBtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.shareBtn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.miniBar { position: fixed; z-index: 39; inset-inline: 0; top: calc(var(--topH, 57px) - 1px); display: flex; justify-content: center; align-items: center; gap: 16px;
  padding: 7px 12px; color: #fff; background: var(--band, #3e4b48); font-size: .9rem; font-weight: 600; transform: translateY(-110%); transition: transform .25s ease;
  box-shadow: 0 8px 18px rgba(20, 50, 45, .18); pointer-events: none; }
.miniBar.show { transform: none; }
.miniBar b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.miniBar em { font-style: normal; background: rgba(255, 255, 255, .2); border-radius: 99px; padding: .05rem .6rem; font-size: .82rem; }

/* boxes */
.gBox { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.gBox h2 { margin: 0 0 10px; font-size: 1.12rem; }
.gBox h2 small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.boxHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.boxHead h2 { margin: 0; }
.linkBtn { border: 0; background: transparent; color: var(--rose); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; padding: .3rem .4rem; border-radius: 8px; }
.linkBtn:hover { background: var(--rose-soft); }
.note { margin: 8px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.8; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }

/* one course: its number, an optional name, the grade and the hours as chips */
.course { border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 12px; margin-bottom: 10px; background: var(--bg); transition: border-color .2s ease, background .2s ease; }
.course.done { background: #fff; border-color: #cfe6dd; }
.cTop { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cNo { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--muted); font-size: .85rem; flex: none; }
.course.done .cNo { background: var(--primary); border-color: var(--primary); color: #fff; }
.cName { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: .92rem; padding: .3rem .2rem; color: var(--ink); border-bottom: 1px dashed transparent; }
.cName:focus { outline: none; border-bottom-color: var(--line); }
.cPts { font-size: .78rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.cDel { width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; font-size: 1rem; flex: none; }
.cDel:hover { background: var(--rose-soft); color: var(--rose); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gLbl { display: block; font-size: .76rem; font-weight: 700; color: var(--muted); margin: 2px 2px 6px; }
.chip { min-width: 46px; height: 40px; padding: 0 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; font: inherit; font-weight: 700;
  font-size: .95rem; cursor: pointer; display: inline-grid; place-items: center; line-height: 1; -webkit-tap-highlight-color: transparent; transition: transform .08s ease; }
.chip:active { transform: scale(.94); }
.chip.on { color: #fff; border-color: transparent; background: var(--c, var(--primary)); box-shadow: 0 4px 10px rgba(20, 50, 45, .15); }
/* grades: one row of nine on a wide screen, five to a row on a phone; letter grades read left to right («A+», not «+A») */
.chips.g { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); }
.chips.g .chip { min-width: 0; padding: 0; }
.chip[data-g] { direction: ltr; unicode-bidi: isolate; }
/* hours: a different control from the grades (a grey track, the chosen hour a white pill), under a dashed line */
.hRow { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d3dedb; }
.hRow .gLbl { margin: 0; flex: none; }
.hSeg { flex: 1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 12px; background: #e6edeb; }
.hBtn { height: 34px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; font-size: .92rem; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hBtn.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 50, 45, .2); }
.pctRow { display: flex; align-items: center; gap: 10px; }
.pctRow input { max-width: 140px; }
.pctRow span { font-size: .85rem; font-weight: 700; color: var(--primary); }
.addBtn { width: 100%; border: 1.5px dashed #b9d6cc; background: transparent; color: var(--primary); border-radius: 14px; padding: .75rem; font: inherit; font-weight: 700; cursor: pointer; }
.addBtn:hover { background: var(--primary-soft); }

/* «كم أحتاج؟» */
.target { border-color: #f1d9a8; background: linear-gradient(180deg, #fffaf0, #fff); }
.tOut { margin-top: 12px; border-radius: 14px; padding: 12px 14px; font-weight: 600; line-height: 1.8; background: var(--primary-soft); color: #0b4d3c; }
.tOut b { font-size: 1.35rem; }
.tOut.hard { background: #fdecef; color: #8f2338; }
.tOut.easy { background: #e8f4fd; color: #1d4f7a; }

.gTable summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.gTable[open] summary { margin-bottom: 10px; }
.bands { display: grid; gap: 6px; margin-bottom: 12px; }
.bands span { display: flex; justify-content: space-between; padding: .35rem .7rem; border-radius: 10px; font-size: .88rem; font-weight: 600; color: #fff; }
.tableWrap { overflow-x: auto; }
.gTable table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.gTable th, .gTable td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.gTable th { color: var(--muted); font-weight: 600; font-size: .8rem; }

.gFoot { text-align: center; padding: 20px 16px 34px; color: var(--muted); font-size: .88rem; }
.gFoot p { margin: 6px 0 0; }
.gFoot a { color: var(--primary); }
.gFoot .gBrand { color: var(--ink); }
.gToast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 60; background: #123a30; color: #fff;
  border-radius: 12px; padding: .6rem 1rem; font-weight: 600; font-size: .92rem; transition: opacity .2s ease, transform .2s ease; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.gToast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .gTitle { display: none; }
  .gResult { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; text-align: center; }
  .ring { align-self: center; width: 150px; height: 150px; }
  .ringTxt b { font-size: 2.4rem; }
  .rRate, .shareBtn { justify-self: center; }
  .shareBtn { width: 100%; justify-content: center; }
  .chips.g { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .chip[data-g="F"] { grid-column: span 2; } /* nine grades in five columns: F takes the last two cells */
}
@media (prefers-reduced-motion: reduce) { .ring .val, .miniBar, .gResult { transition: none; } }

/* Office tip under the calculator: quiet, one line on the phone, never louder than the tool */
.gOffice { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 14px 16px; border-radius: 18px; background: linear-gradient(135deg, #f3f7ff, #fff); border: 1px solid #d8e3f7; color: var(--ink); text-decoration: none; }
.gOffice:hover { border-color: #b9cdf0; }
.oIco { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #e5eefc; color: #2f6fd6; }
.oIco svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.oTxt { flex: 1; display: grid; gap: 1px; min-width: 0; }
.oTxt small { color: #2f6fd6; font-size: .74rem; font-weight: 700; }
.oTxt b { font-size: .98rem; }
.oTxt em { font-style: normal; color: var(--muted); font-size: .82rem; }
.oGo { flex: none; font-size: 1.5rem; color: #2f6fd6; line-height: 1; }

/* previous record: a switch, then two dials (number, − / +, slider); the numbers read left to right like a ruler */
.swRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.swRow span { display: grid; gap: 2px; }
.swRow b { font-size: 1.05rem; }
.swRow small { color: var(--muted); font-size: .82rem; }
.sw { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.swT { flex: none; width: 50px; height: 30px; border-radius: 99px; background: #d5dedb; position: relative; transition: background .2s; }
.swT::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s; }
.sw:checked + .swT { background: var(--primary); }
.sw:checked + .swT::after { transform: translateX(-20px); }
.sw:focus-visible + .swT { outline: 2px solid var(--primary); outline-offset: 2px; }
.swRow { position: relative; }
.prevBody { display: grid; gap: 18px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.prevBody[hidden] { display: none; }
.dLbl { display: block; font-size: .88rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.dNum { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 14px; }
.dStep { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--primary); font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.dStep:active { background: var(--primary-soft); }
.dVal { width: 6.2ch; border: 0; border-bottom: 2px solid transparent; background: transparent; text-align: center; font: inherit; font-size: 2.1rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; padding: 0; border-radius: 0; }
.dVal::placeholder { color: #b9c4c1; }
.dVal:focus { outline: none; border-bottom-color: var(--primary); }
.dRange { direction: ltr; display: block; width: 100%; margin: 10px 0 0; height: 28px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.dRange::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--primary) var(--p, 0%), #e2e9e7 var(--p, 0%)); }
.dRange::-moz-range-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--primary) var(--p, 0%), #e2e9e7 var(--p, 0%)); }
.dRange::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); box-shadow: 0 2px 6px rgba(20, 50, 45, .25); }
.dRange::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); box-shadow: 0 2px 6px rgba(20, 50, 45, .25); }
.dRange:focus-visible { outline: 2px solid var(--primary-soft); }
.dEnds { direction: ltr; display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 2px; }
