/* Stage 6-3 — 받아내림 없는 대분수 뺄셈 (s52 카드형 빈칸 학습) */

.s63-screen{
  --s63-wrap-w: 1200px;
  --s63-box-h: calc(720px - 1.5cm + 34px);
  position:relative;
  width:1920px;
  height:1080px;
  overflow:hidden;
  color:#effbff;
  background:#030711;
}

.s63-bg{
  position:absolute;
  inset:0;
  background:
    linear-gradient(90deg, rgba(8,12,18,.24), rgba(8,12,18,.08), rgba(8,12,18,.24)),
    url("../assets/images/s6.png") center / cover no-repeat;
  filter:brightness(.92) saturate(.92);
}

.s63-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.34));
}

.s63-board{
  position:absolute;
  left:50%;
  top:122px;
  z-index:5;
  display:flex;
  flex-direction:column;
  gap:0;
  box-sizing:border-box;
  width:min(var(--s63-wrap-w), calc(100% - 80px));
  height:var(--s63-box-h);
  min-height:var(--s63-box-h);
  max-height:var(--s63-box-h);
  padding:36px 42px 32px;
  transform:translateX(-50%);
  border:1px solid rgba(90,141,166,.78);
  border-radius:26px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.9), transparent 34%),
    linear-gradient(180deg, #f8f5ee 0%, #eef3f5 100%);
  box-shadow:0 20px 50px rgba(13,30,44,.18), inset 0 1px 0 rgba(255,255,255,.78);
  font-family:var(--edu-worksheet-font, "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif);
}

.s63-board.is-all-complete{
  /* 마지막 빈칸을 맞힌 뒤에도 방법 패널의 기준 Y 위치를 유지한다. */
  gap:0;
}

.s63-board-header.s21-sheet-header.edu-worksheet-header{
  position:static;
  flex:0 0 auto;
  margin:0 0 20px;
  padding:0 0 14px;
  border-bottom:1px solid #C5D8DE;
  box-sizing:border-box;
  width:auto;
  max-width:none;
  transform:none;
  z-index:auto;
}

.s63-board-header .s21-sheet-title.edu-worksheet-title{
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  color:#18384C;
  font-family:var(--edu-worksheet-font, "Pretendard", "Noto Sans KR", system-ui, sans-serif);
  font-size:var(--edu-worksheet-title-size, 30px);
  font-weight:var(--edu-worksheet-title-weight, 800);
  letter-spacing:var(--edu-worksheet-title-letter-spacing, 0.02em);
  line-height:1.2;
  text-align:left;
  text-shadow:none;
  white-space:normal;
}

.s63-methods{
  --s63-panel-height:536px;
  display:grid;
  flex:1 1 auto;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:18px;
  align-items:stretch;
  width:100%;
  height:var(--s63-panel-height);
  max-height:var(--s63-panel-height);
  min-height:var(--s63-panel-height);
}

.s63-method-panel{
  position:relative;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  gap:0;
  min-height:0;
  height:100%;
  overflow:hidden;
  padding:0 0 16px;
  border:2px solid rgba(209,218,226,.95);
  border-radius:20px;
  background:rgba(255,255,255,.82);
  box-shadow:0 12px 24px rgba(36,58,76,.08), inset 0 1px 0 rgba(255,255,255,.9);
  transition:border-color .28s ease, box-shadow .28s ease, opacity .28s ease, filter .28s ease;
}

.s63-method-panel::before{
  display:none;
}

.s63-method-1{
  border-color:#b89ee8;
  background:rgba(255,255,255,.82);
}

.s63-method-2{
  border-color:#e4c66a;
  background:rgba(255,255,255,.82);
}

.s63-method-panel.is-active{
  box-shadow:0 12px 24px rgba(45,90,120,.11), inset 0 1px 0 rgba(255,255,255,.96);
  filter:none;
  opacity:1;
}

.s63-method-1.is-active{
  border-color:#9b78df;
  box-shadow:0 12px 24px rgba(104,75,173,.14), inset 0 1px 0 rgba(255,255,255,.96);
}

.s63-method-2.is-active{
  border-color:#dfb933;
  box-shadow:0 12px 24px rgba(160,126,25,.13), inset 0 1px 0 rgba(255,255,255,.96);
}

.s63-method-panel.is-waiting,
.s63-method-panel.is-preview{
  opacity:1;
  filter:none;
  pointer-events:none;
}

.s63-method-panel.is-complete{
  opacity:1;
  filter:none;
  box-shadow:0 12px 24px rgba(49,96,71,.1), inset 0 1px 0 rgba(255,255,255,.96);
}

.s63-method-head{
  position:relative;
  display:flex;
  flex-direction:row;
  flex-wrap:nowrap;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  min-height:48px;
  padding:6px 12px;
  border-bottom:0;
}

.s63-method-1 .s63-method-head{
  background:linear-gradient(90deg, #e9ddff 0%, #eee5ff 55%, #f6f0ff 100%);
}

.s63-method-2 .s63-method-head{
  background:linear-gradient(90deg, #fff0b8 0%, #fff4c9 55%, #fff9df 100%);
}

.s63-method-label{
  position:static;
  transform:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:0;
  height:auto;
  padding:4px 10px;
  border:0;
  border-radius:999px;
  color:#fff;
  background:#e4b32e;
  box-shadow:0 2px 6px rgba(182,139,24,.22);
  font-size:18px;
  font-weight:900;
  letter-spacing:-.02em;
  line-height:1;
  white-space:nowrap;
}

.s63-method-1 .s63-method-label{
  color:#fff;
  background:#8260d9;
  box-shadow:0 2px 6px rgba(103,75,186,.24);
}

.s63-method-head h2{
  margin:0;
  flex:1 1 auto;
  min-width:0;
  color:#0f2942;
  font-size:20px;
  font-weight:800;
  letter-spacing:-.03em;
  line-height:1.2;
  white-space:nowrap;
  text-align:left;
  overflow:hidden;
  text-overflow:ellipsis;
}

.s63-method-head em{
  display:none;
}

.s63-method-formula{
  --s63-formula-fs:30px;
  --math-fs:var(--s63-formula-fs);
  --blank-sm:calc(var(--s63-formula-fs) * 1.22);
  --blank-md:calc(var(--s63-formula-fs) * 1.68);
  --blank-h:calc(var(--s63-formula-fs) * 1.18);
  position:relative;
  display:grid;
  gap:10px;
  justify-items:stretch;
  align-content:start;
  padding:18px 18px 4px 1.6cm;
  overflow:visible;
  min-height:0;
}

.s63-board .s63-method-formula .textbook-math.s63-math{
  --math-fs:var(--s63-formula-fs);
  --blank-sm:calc(var(--s63-formula-fs) * 1.22);
  --blank-md:calc(var(--s63-formula-fs) * 1.68);
  --blank-h:calc(var(--s63-formula-fs) * 1.18);
  --num-h:var(--blank-h);
  --den-h:var(--blank-h);
  display:inline-flex;
  align-items:center;
  vertical-align:middle;
}

.s63-board .s63-method-formula .s63-tm-input{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:var(--blank-sm, 40px);
  min-width:var(--blank-sm, 40px);
  height:var(--blank-h, 40px);
  box-sizing:border-box;
  border:2px solid rgba(120, 200, 255, 0.55);
  border-radius:8px;
  background:rgba(255,255,255,.96);
  color:#0d1f35;
  -webkit-text-fill-color:#0d1f35;
  font:inherit;
  font-weight:900;
  line-height:1;
  text-align:center;
  box-shadow:none;
  outline:none;
}

.s63-board .s63-method-formula .s63-tm-input.tm-blank-md{
  width:var(--blank-md, 50px);
  min-width:var(--blank-md, 50px);
}

.s63-board .s63-method-formula .s63-tm-input:focus,
.s63-board .s63-method-formula .s63-tm-input:focus-visible{
  border-color:rgba(47,145,196,.9);
  box-shadow:0 0 0 4px rgba(47,145,196,.14);
}

.s63-board .s63-method-formula .s63-tm-input:disabled:not(.is-correct){
  opacity:.42;
  border-color:rgba(120, 200, 255, .32);
  background:rgba(248,252,255,.72);
  color:transparent;
  -webkit-text-fill-color:transparent;
}

.s63-board .s63-method-formula .s63-tm-input.is-correct{
  border-color:rgba(120,200,255,.55);
  background:rgba(248,252,255,.98);
  color:#0d1f35;
  -webkit-text-fill-color:#0d1f35;
  box-shadow:0 0 0 2px rgba(120,200,255,.08);
  opacity:1;
}

.s63-board .s63-method-formula .s63-tm-input.is-error{
  border-color:rgba(245,158,11,.9);
  color:#9a5c00;
  -webkit-text-fill-color:#9a5c00;
  background:rgba(255,251,235,.98);
  box-shadow:0 0 0 4px rgba(245,158,11,.16);
  animation:s63-shake .42s ease;
}

/* 오답은 포커스 상태에서도 공통 노란 테두리를 유지한다. */
.s63-board .s63-method-formula input.s63-tm-input.is-error,
.s63-board .s63-method-formula input.s63-tm-input.is-error:focus,
.s63-board .s63-method-formula input.s63-tm-input.is-wrong,
.s63-board .s63-method-formula input.s63-tm-input.is-wrong:focus{
  border:2px solid #e5a735 !important;
  background:#fff7df !important;
  box-shadow:0 0 0 4px rgba(229,167,53,.20) !important;
}

.s63-formula-line{
  display:grid;
  grid-template-columns:24px minmax(0,1fr);
  align-items:center;
  width:100%;
  min-height:42px;
}

.s63-formula-line.is-first{
  grid-template-columns:minmax(0,1fr);
}

.s63-formula-line.is-first .s63-equals{
  display:none;
}

.s63-equals{
  display:inline-flex;
  align-items:center;
  height:46px;
  color:#0d1f35;
  font-size:var(--s63-formula-fs);
  font-weight:950;
  line-height:1;
  text-align:left;
  text-shadow:none;
}

.s63-expression{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:nowrap;
  gap:8px;
  color:#10243f;
  font-size:var(--s63-formula-fs);
  font-weight:950;
}

.s63-mixed{
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}

.s63-mixed > .textbook-whole{
  font-size:var(--s63-formula-fs);
  font-weight:950;
  line-height:1;
}

.s63-answer-frac{
  color:#277a50;
  text-shadow:none;
}

.s63-op,
.s63-paren,
.s63-inline-equals{
  color:#0d1f35;
  font-size:var(--s63-formula-fs);
  font-weight:950;
  text-shadow:none;
}

.s63-inline-equals{
  display:inline-flex;
  align-items:center;
  height:46px;
  line-height:1;
  margin:0 10px;
}

.s63-method-footer{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding-top:2px;
}

.s63-method-footer:empty{
  display:none;
}

.s63-method-2 .s63-btn-next{
  position:absolute;
  right:28px;
  bottom:28px;
  z-index:3;
  animation:s63-fade-in .35s ease;
}

/* s62 「다음」과 동일한 디자인·크기 (다른 요소는 변경하지 않음) */
.s63-btn,
.s63-btn-next,
#s63-next-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:auto;
  min-width:104px;
  max-width:148px;
  height:40px;
  min-height:40px;
  padding:0 14px;
  border:1px solid rgba(67, 179, 220, .72);
  border-radius:11px;
  color:#102f42;
  -webkit-text-fill-color:#102f42;
  background:linear-gradient(180deg, #91ebff 0%, #43bfe9 100%);
  box-shadow:
    0 8px 17px rgba(38, 157, 203, .22),
    inset 0 1px 0 rgba(255, 255, 255, .68);
  font-size:14px;
  line-height:1;
  font-weight:900;
  letter-spacing:-0.035em;
  white-space:nowrap;
  box-sizing:border-box;
  cursor:pointer;
  transition:filter .2s ease, transform .2s ease;
}

.s63-btn:hover,
.s63-btn:focus-visible,
.s63-btn-next:hover,
.s63-btn-next:focus-visible,
#s63-next-btn:hover,
#s63-next-btn:focus-visible{
  filter:brightness(1.03);
  transform:translateY(-1px);
}


@keyframes s63-shake{
  0%,100%{transform:translateX(0);}
  20%{transform:translateX(-5px);}
  40%{transform:translateX(5px);}
  60%{transform:translateX(-3px);}
  80%{transform:translateX(3px);}
}

@keyframes s63-fade-in{
  from{opacity:0; transform:translateY(8px);}
  to{opacity:1; transform:translateY(0);}
}

@media (prefers-reduced-motion:reduce){
  .s63-tm-input.is-error,
  .s63-tm-input.is-shake{animation:none!important;}
}
