/*
Theme Name: Math Salad
Theme URI: https://mathsalad.com
Description: Math Salad — Commercial UI visual system built from the approved v5.2 student experience.
Version: 5.3
Text Domain: math-salad
WPVibe: yes
*/

/* =========================================================
   Math Salad v5.3 — Commercial UI
   Clean rebuild from the approved v5.2 baseline.
   Functional class names and interaction states are preserved.
   ========================================================= */

:root{
  --ms-ink:#17324d;
  --ms-muted:#61758a;
  --ms-green:#2fb36d;
  --ms-green-dark:#18834d;
  --ms-green-soft:#e4f8ec;
  --ms-orange:#ff9d3d;
  --ms-orange-dark:#d97816;
  --ms-orange-soft:#fff0df;
  --ms-mint:#effbf5;
  --ms-sky:#eef7ff;
  --ms-blue:#3a7fd5;
  --ms-blue-dark:#245eaa;
  --ms-yellow:#ffd866;
  --ms-red:#e85b5b;
  --ms-purple:#7d63d8;
  --ms-white:#ffffff;
  --ms-line:#dbe9e3;
  --ms-shadow:0 14px 34px rgba(34,79,67,.12);
  --ms-shadow-soft:0 7px 20px rgba(34,79,67,.09);
  --ms-radius-xl:28px;
  --ms-radius-lg:22px;
  --ms-radius-md:16px;
  --ms-radius-sm:12px;
}

*{box-sizing:border-box}

html{scroll-behavior:smooth}

body{
  margin:0;
  font-family:"Nunito","Avenir Next","Segoe UI",Arial,sans-serif;
  background:
    radial-gradient(circle at 8% 4%,rgba(47,179,109,.11),transparent 26rem),
    radial-gradient(circle at 92% 8%,rgba(255,157,61,.10),transparent 24rem),
    linear-gradient(180deg,#f7fcfa 0%,#eef8ff 100%);
  color:var(--ms-ink);
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
}

button,input,select,textarea{font:inherit}
button{cursor:pointer}
img{max-width:100%;height:auto}

/* WordPress surface polish */
.wp-site-blocks{min-height:100vh}
.wp-block-group,.wp-block-column,.wp-block-cover__inner-container{border-radius:var(--ms-radius-lg)}
.wp-block-button__link,
.wp-element-button{
  border:0;
  border-radius:999px;
  padding:.82rem 1.2rem;
  font-weight:900;
  background:linear-gradient(135deg,var(--ms-green),var(--ms-green-dark));
  color:#fff;
  box-shadow:0 8px 18px rgba(47,179,109,.22);
  transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
.wp-block-button__link:hover,
.wp-element-button:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(47,179,109,.28);filter:saturate(1.04)}

/* Core app shell */
.app{max-width:760px;margin:auto;padding:16px}

.hero{
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  align-items:center;
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(circle at 88% 18%,rgba(255,255,255,.48),transparent 8rem),
    linear-gradient(135deg,#dff7ea 0%,#eaf7ff 55%,#fff1df 100%);
  color:var(--ms-ink);
  padding:22px;
  border:2px solid rgba(47,179,109,.18);
  border-radius:var(--ms-radius-xl);
  margin-bottom:14px;
  box-shadow:var(--ms-shadow);
}
.hero:before{
  content:"";
  position:absolute;
  width:150px;height:150px;border-radius:50%;
  right:-58px;bottom:-78px;
  background:rgba(255,157,61,.16);
}
.hero h1{position:relative;margin:0 0 5px;font-size:clamp(26px,5vw,36px);line-height:1.05;font-weight:950;letter-spacing:-.02em}
.hero p{position:relative;margin:0;color:#48647a;font-weight:800}

.menu-toggle{
  position:relative;
  border:2px solid rgba(47,179,109,.26);
  border-radius:999px;
  padding:11px 16px;
  background:#fff;
  color:var(--ms-green-dark);
  font-weight:950;
  font-size:15px;
  white-space:nowrap;
  box-shadow:var(--ms-shadow-soft);
}

.tabs{display:none;grid-template-columns:repeat(2,1fr);gap:8px;margin-bottom:12px}
.tabs.skill-drawer-open{
  display:grid;
  margin-top:10px;
  padding:12px;
  background:rgba(255,255,255,.8);
  border:2px solid #dcefe6;
  border-radius:20px;
  box-shadow:var(--ms-shadow-soft);
}
.tab{
  border:2px solid #e2eee8;
  border-radius:15px;
  background:#fff;
  color:var(--ms-ink);
  padding:11px 7px;
  font-weight:900;
  box-shadow:0 3px 10px rgba(34,79,67,.06);
  transition:.18s ease;
}
.tab:hover{transform:translateY(-1px);border-color:#bfe5cf}
.tab.active{
  background:linear-gradient(135deg,var(--ms-green),var(--ms-green-dark));
  border-color:transparent;
  color:#fff;
  box-shadow:0 7px 18px rgba(47,179,109,.22);
}

.card,
.student-focus-card,
.dashboard-card,
.parent-card,
.teacher-card,
.progress-card{
  background:rgba(255,255,255,.96);
  border:2px solid rgba(219,233,227,.95);
  border-radius:var(--ms-radius-xl);
  padding:16px;
  box-shadow:var(--ms-shadow);
}

.topbar{display:flex;justify-content:space-between;gap:7px;align-items:center;margin-bottom:11px;flex-wrap:wrap}
.pill{
  background:var(--ms-green-soft);
  color:var(--ms-green-dark);
  border:1px solid #c9eed8;
  padding:8px 11px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
}

.coach{
  background:linear-gradient(135deg,#fff9dc,#fff3c1);
  border:2px solid #f1cf59;
  border-radius:18px;
  padding:14px;
  line-height:1.4;
  margin-bottom:12px;
  font-weight:800;
  box-shadow:0 6px 14px rgba(173,127,0,.08);
}
.story{
  display:none;
  background:linear-gradient(135deg,#edf8ff,#f5fbff);
  border:2px solid #a9d5f7;
  border-radius:18px;
  padding:14px;
  margin-bottom:12px;
  font-weight:900;
  font-size:18px;
  line-height:1.4;
}

.board{display:grid;gap:8px}
.label{text-align:center;font-size:10px;font-weight:950;color:#718395;text-transform:uppercase;letter-spacing:.08em}

.cell{
  position:relative;
  height:70px;
  border:2px dashed #cfded7;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:34px;
  font-weight:950;
  background:#fff;
  min-width:0;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7);
  transition:border-color .18s ease,background .18s ease,box-shadow .18s ease,transform .18s ease;
}
.cell.fixed{border-color:transparent;background:transparent}
.cell.active{border:3px solid var(--ms-blue);background:var(--ms-sky);box-shadow:0 0 0 5px rgba(58,127,213,.10)}
.cell.active-second{border:3px solid var(--ms-orange);background:var(--ms-orange-soft);box-shadow:0 0 0 5px rgba(255,157,61,.13)}
.cell.dynamic-rewrite{border-color:var(--ms-orange);background:var(--ms-orange-soft)}
.cell.correct{border:3px solid var(--ms-green);background:#ecfbf2;box-shadow:0 0 0 5px rgba(47,179,109,.11)}
.cell.wrong{border:3px solid var(--ms-red);background:#fff0f0;animation:msShake .24s ease}
.cell canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;touch-action:none}
.entry{position:relative;z-index:2}
.rule{height:4px;background:var(--ms-ink);border-radius:4px;align-self:center}

.status{text-align:center;min-height:40px;padding:10px 4px;color:var(--ms-muted);font-weight:800}
.keypad{display:none;background:#f3faf6;border:2px solid #e0eee7;border-radius:20px;padding:11px;margin-top:6px}
.keys{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.key{
  border:2px solid #e3eee9;
  border-radius:15px;
  background:#fff;
  color:var(--ms-ink);
  box-shadow:0 4px 10px rgba(34,79,67,.08);
  font-size:25px;
  font-weight:950;
  padding:13px;
  transition:.15s ease;
}
.key:active{transform:scale(.97);background:var(--ms-green-soft)}
.key.zero{grid-column:2}

.controls{display:flex;gap:9px;margin-top:13px}
.btn,
.student-action{
  flex:1;
  border:0;
  border-radius:16px;
  padding:14px 12px;
  font-weight:950;
  background:linear-gradient(135deg,var(--ms-green),var(--ms-green-dark));
  color:#fff;
  box-shadow:0 8px 18px rgba(47,179,109,.22);
  transition:.18s ease;
}
.btn:hover,.student-action:hover{transform:translateY(-1px);box-shadow:0 10px 23px rgba(47,179,109,.27)}
.btn.secondary,
.student-action.secondary{
  background:#fff;
  color:var(--ms-green-dark);
  border:2px solid #bfe5cf;
  box-shadow:var(--ms-shadow-soft);
}
.btn.orange,.student-action.orange,.get-help{
  background:linear-gradient(135deg,#ffae54,var(--ms-orange));
  color:#5b3305;
  border:0;
}

.overlay{
  display:none;
  position:fixed;
  z-index:50;
  left:4%;right:4%;top:20%;
  background:linear-gradient(145deg,#fff,#f3f0ff);
  border:3px solid #9d88ea;
  border-radius:26px;
  padding:26px 16px;
  text-align:center;
  box-shadow:0 22px 55px rgba(48,37,88,.24);
}
.overlay h2{font-size:25px;margin:0 0 15px}
.blocks{font-size:28px;font-weight:950}

/* Student focus */
.drawer-label{display:none;color:var(--ms-green-dark);font-weight:950;margin:4px 0 8px}
.drawer-label.show{display:block}
.student-focus-card{margin:12px 0}
.student-focus-title{color:var(--ms-ink);font-weight:950;font-size:23px;margin-bottom:6px}
.student-focus-sub{color:var(--ms-muted);font-weight:800;line-height:1.4}
.student-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}

/* Commercial-style progress */
.progress-wrap,.progress-track{
  width:100%;
  min-height:12px;
  border-radius:999px;
  background:#e8f0ec;
  overflow:hidden;
}
.progress-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,var(--ms-green),#58c986);
  box-shadow:0 2px 7px rgba(47,179,109,.22);
}
.progress-label{display:flex;justify-content:space-between;gap:10px;color:var(--ms-muted);font-size:12px;font-weight:900;margin-bottom:6px}

/* Parent / teacher / administrator dashboard language */
.dashboard-grid,.student-grid,.class-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}
.dashboard-card,.parent-card,.teacher-card,.progress-card{padding:15px}
.dashboard-title,.panel-title{font-size:20px;font-weight:950;color:var(--ms-ink);margin:0 0 8px}
.dashboard-sub,.panel-sub{color:var(--ms-muted);font-weight:750}
.student-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:11px 12px;
  margin:7px 0;
  background:#f9fcfa;
  border:1px solid #e1ece7;
  border-radius:15px;
}
.status-light{
  width:13px;height:13px;border-radius:50%;
  flex:0 0 13px;
  box-shadow:0 0 0 4px rgba(0,0,0,.035);
}
.status-light.green,.status-green{background:var(--ms-green)}
.status-light.yellow,.status-yellow{background:var(--ms-yellow)}
.status-light.red,.status-red{background:var(--ms-red)}
.status-light.orange,.status-orange{background:var(--ms-orange)}

.help-alert,.get-help-alert,.live-assist{
  border:2px solid #ffd0a0;
  background:linear-gradient(135deg,#fff6eb,#fffaf4);
  border-radius:18px;
  padding:13px;
  color:#754214;
  font-weight:850;
}

/* Badges and state/grade/age personalization */
.badge,.ms-badge,.state-badge,.grade-badge,.age-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  padding:6px 10px;
  border-radius:999px;
  background:#fff;
  border:2px solid #dcece4;
  color:var(--ms-ink);
  font-size:12px;
  font-weight:900;
}
.state-badge{background:var(--ms-sky);border-color:#cde5f7;color:#245e88}
.grade-badge{background:var(--ms-green-soft);border-color:#c9eed8;color:var(--ms-green-dark)}
.age-badge{background:var(--ms-orange-soft);border-color:#ffd7ad;color:#9a5716}

/* Rounding guide */
.round-guide{display:none;margin:0 0 12px;background:#f7fcff;border:2px solid #c9e4f6;border-radius:20px;padding:14px;box-shadow:var(--ms-shadow-soft)}
.round-guide.show{display:block}
.round-title{text-align:center;font-weight:950;color:var(--ms-blue-dark);margin-bottom:10px}
.round-track{position:relative;height:68px;margin:4px 18px 0}
.round-line{position:absolute;left:0;right:0;top:34px;height:8px;border-radius:999px;background:#cbe5f7}
.round-mid{position:absolute;left:50%;top:22px;width:4px;height:32px;background:var(--ms-orange);border-radius:4px}
.round-worm{position:absolute;top:0;transform:translateX(-50%);transition:left .35s ease;width:54px;height:28px;border-radius:999px;background:#7ddf64;border:3px solid #166534;box-shadow:0 5px 10px #0002}
.round-worm:before,.round-worm:after{content:"";position:absolute;top:7px;width:5px;height:5px;border-radius:50%;background:var(--ms-ink)}
.round-worm:before{right:9px}.round-worm:after{right:20px}
.round-labels{display:flex;justify-content:space-between;font-weight:900;color:#334155}
.round-midlabel{text-align:center;color:var(--ms-orange-dark);font-weight:850;font-size:12px;margin-top:-18px}
.round-hint{min-height:22px;text-align:center;font-weight:850;color:var(--ms-muted);margin-top:8px}
.round-guide.hint1 .round-mid{animation:midpulse .8s ease-in-out 2}
.round-guide.hint2 .round-line{box-shadow:0 0 0 5px rgba(58,127,213,.12)}

/* Property Guide */
.property-guide{display:none;margin:0 0 12px;background:#fffaf2;border:2px solid #ffd3a2;border-radius:20px;padding:14px;box-shadow:var(--ms-shadow-soft)}
.property-guide.show{display:block}
.property-name{text-align:center;font-weight:950;color:#8a4812;font-size:18px}
.property-visual{display:flex;justify-content:center;align-items:center;gap:10px;min-height:56px;margin:8px 0;font-size:25px;font-weight:950;color:var(--ms-ink)}
.property-chip{display:inline-flex;min-width:42px;height:42px;padding:0 9px;align-items:center;justify-content:center;border-radius:13px;background:#fff;border:2px solid #cbdad3;transition:transform .35s ease,box-shadow .35s ease,opacity .35s ease}
.property-zero{background:#f1f7f4}
.property-guide.hint1 .property-focus{box-shadow:0 0 0 5px rgba(255,157,61,.18);transform:scale(1.08)}
.property-guide.identity.hint2 .property-zero{opacity:.28;transform:scale(.72)}
.property-guide.commutative.hint2 .property-left{animation:swapL .8s ease}
.property-guide.commutative.hint2 .property-right{animation:swapR .8s ease}
.property-group{position:relative;padding:4px 8px 10px}
.property-group:after{content:"";position:absolute;left:5px;right:5px;bottom:1px;height:8px;border:3px solid var(--ms-purple);border-top:0;border-radius:0 0 10px 10px}
.property-guide.associative.hint2 .group-a{animation:groupfade .8s ease}
.property-guide.associative.hint2 .group-b{animation:grouppop .8s ease}
.property-hint{min-height:22px;text-align:center;font-weight:850;color:var(--ms-muted)}

/* Adaptive Mixed Practice */
.adaptive-panel{display:none;margin:0 0 12px;background:#f2fced;border:2px solid #bfe99b;border-radius:20px;padding:13px 14px;box-shadow:var(--ms-shadow-soft)}
.adaptive-panel.show{display:block}
.adaptive-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;font-weight:950;color:#32671d}
.adaptive-skill{font-size:18px}
.adaptive-level{font-size:12px;background:#fff;border:2px solid #d3efbd;border-radius:999px;padding:5px 9px}
.adaptive-msg{margin-top:6px;color:var(--ms-muted);font-weight:850;text-align:center;line-height:1.35}

/* Division Pathway */
.division-path-card{
  background:linear-gradient(145deg,#f3fbff,#f8fffb);
  border:2px solid #cbe4f4;
  border-radius:22px;
  padding:15px;
  margin-bottom:12px;
  box-shadow:var(--ms-shadow-soft);
}
.division-path-title{font-weight:950;font-size:20px;color:var(--ms-blue-dark);text-align:center;margin-bottom:10px}
.division-path-steps{display:flex;gap:7px;flex-wrap:wrap;justify-content:center}
.division-path-step{background:#fff;border:2px solid #d7e8f5;color:#245e88;border-radius:999px;padding:7px 10px;font-weight:900;font-size:12px}
.division-path-step.active{background:linear-gradient(135deg,var(--ms-blue),var(--ms-blue-dark));color:#fff;border-color:transparent}
.division-visual{background:#fff;border:2px solid #e0ebe5;border-radius:22px;padding:14px;margin:10px 0;text-align:center;box-shadow:var(--ms-shadow-soft)}
.division-visual-title{color:var(--ms-blue-dark);font-size:20px;font-weight:950;margin-bottom:8px}
.group-row{display:flex;justify-content:center;gap:12px;flex-wrap:wrap;margin:12px 0}
.group-box{min-width:74px;min-height:68px;border:2px solid #c7e3f5;border-radius:18px;background:#eef8ff;padding:8px;font-size:25px;display:flex;align-items:center;justify-content:center}
.item-dot{display:inline-flex;width:20px;height:20px;align-items:center;justify-content:center;margin:2px;border-radius:50%;background:var(--ms-yellow);border:2px solid #bf7918}
.division-card-problem{display:flex;justify-content:center;align-items:center;gap:10px;flex-wrap:wrap;font-size:30px;font-weight:950;margin:12px 0}
.division-answer-row{display:flex;justify-content:center;gap:8px;margin-top:10px}
.division-answer-cell{width:68px!important;min-width:68px!important;height:72px!important;border-radius:18px!important;font-size:34px!important;background:#eef8ff!important}
.longdiv-label{font-size:12px!important;color:#708194!important;font-weight:900!important}
.longdiv-helper{background:#eef8ff!important;border:2px solid #c8e4f6!important;color:var(--ms-blue-dark)!important}
.division-tip{margin-top:10px;color:var(--ms-muted);font-weight:850;line-height:1.35}

/* Inputs and sign-in surfaces */
input[type="text"],input[type="email"],input[type="password"],input[type="number"],select,textarea{
  width:100%;
  border:2px solid #d9e8e1;
  border-radius:15px;
  background:#fff;
  color:var(--ms-ink);
  padding:12px 13px;
  outline:none;
  box-shadow:0 3px 9px rgba(34,79,67,.04);
}
input:focus,select:focus,textarea:focus{border-color:#88cfaa;box-shadow:0 0 0 4px rgba(47,179,109,.11)}

/* Celebration */
.celebrate,.success-burst{animation:msPop .42s ease}
@keyframes msPop{0%{transform:scale(.94);opacity:.65}70%{transform:scale(1.025)}100%{transform:scale(1);opacity:1}}
@keyframes msShake{25%{transform:translateX(-3px)}50%{transform:translateX(3px)}75%{transform:translateX(-2px)}}
@keyframes midpulse{50%{transform:scaleY(1.45);background:var(--ms-red)}}
@keyframes swapL{50%{transform:translateX(58px)}}
@keyframes swapR{50%{transform:translateX(-58px)}}
@keyframes groupfade{50%{opacity:.25}}
@keyframes grouppop{50%{transform:scale(1.08)}}

@media(min-width:600px){
  .tabs.skill-drawer-open{grid-template-columns:repeat(5,1fr)}
  .cell{height:84px;font-size:40px}
  .label{font-size:12px}
}

@media(max-width:520px){
  .app{padding:10px}
  .hero{grid-template-columns:1fr;padding:18px;border-radius:23px}
  .menu-toggle{width:100%}
  .student-actions{grid-template-columns:1fr}
  .controls{flex-direction:column}
  .card,.student-focus-card,.dashboard-card,.parent-card,.teacher-card,.progress-card{border-radius:22px;padding:13px}
  .division-card-problem{font-size:24px}
  .division-answer-cell{width:58px!important;min-width:58px!important;height:64px!important;font-size:29px!important}
  .group-box{min-width:62px;min-height:58px}
}

.ms-construction-banner{
  max-width:1180px;
  margin:14px auto 0;
  padding:12px 18px;
  border-radius:14px;
  background:#fff3cd;
  border:1px solid #f0d98a;
  color:#5f4a00;
  text-align:center;
  font-weight:700;
}
.ms-site-footer{
  margin-top:48px;
  border-top:1px solid rgba(34,79,67,.12);
  background:#f7fbf8;
}
.ms-site-footer-inner{
  max-width:1180px;
  margin:0 auto;
  padding:24px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  flex-wrap:wrap;
}
.ms-site-footer-copy{font-weight:700;color:var(--ms-ink,#234f43)}
.ms-site-footer-links{display:flex;gap:16px;flex-wrap:wrap}
.ms-site-footer-links a{color:var(--ms-ink,#234f43);text-decoration:none;font-weight:700}
.ms-site-footer-links a:hover{text-decoration:underline}

@media(prefers-reduced-motion:reduce){
  *,*:before,*:after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
