html,
body {
  width: 100%;
  height: 100%;

}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f4f6fb;
  font-family: "Arial Rounded MT Bold", "Helvetica Neue", Arial, sans-serif;
}

.page {
  padding: 24px;
}

.teaching-board {
  position: relative;
  display: flex;
  align-items: center;
  gap: 36px;
}

.calculator {
  width: 700px;
  border-radius: 36px;
  padding: 24px 24px 28px;
  background: radial-gradient(120% 120% at 50% 10%, #3a455a 0%, #252c3b 55%, #1d2230 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), 0 18px 40px rgba(15, 19, 30, 0.45);
}

.display-wrap {
  background: linear-gradient(180deg, #58666b 0%, #49565d 100%);
  border-radius: 18px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35);
}

.display {
  height: 120px;
  border-radius: 12px;
  background: linear-gradient(180deg, #60787d 0%, #738b8f 100%);
  color: #102226;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  font-size: 82px;
  font-weight: 700;
  letter-spacing: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.display.off {
  color: rgba(16, 34, 38, 0.16);
}

.top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.top-strip .key-small {
  min-width: 96px;
}

.top-strip .key {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 2px 0 rgba(7, 10, 16, 0.9);
}

.top-strip .key:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 1px 0 rgba(7, 10, 16, 0.9);
}

.solar-panel {
  width: 180px;
  height: 34px;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, #8b8380 0 28px, #7f7672 28px 32px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.key {
  border: none;
  border-radius: 16px;
  height: 74px;
  font-size: 48px;
  font-weight: 700;
  color: #eef4ff;
  background: linear-gradient(180deg, #2d3547 0%, #1e2534 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 3px 0 rgba(7, 10, 16, 0.9);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 除数字键/小数点键（.key-num）外，其它按键文字全部改为黑色 */
.calculator .key:not(.key-num) {
  color: #000;
}

.key:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 1px 0 rgba(7, 10, 16, 0.9);
}

.key-small {
  height: 56px;
  font-size: 40px;
}

.key-fn {
  background: linear-gradient(180deg, #e7edf3 0%, #cbd4df 100%);
  color: #f5f9ff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.key-op {
  background: linear-gradient(180deg, #dce5ee 0%, #c7d2df 100%);
}

.key-plus {
  background: linear-gradient(180deg, #b5f0ff 0%, #97dce8 100%);
}

.key-equals {
  grid-column: 5;
  grid-row: 5;
  height: 74px;
  background: linear-gradient(180deg, #dce5ee 0%, #c7d2df 100%);
}

.guide-panel {
  width: 480px;
  min-height: 380px;
  border-radius: 24px;
  padding: 20px;
  background: linear-gradient(180deg, #1e2f4b 0%, #17253e 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 16px 36px rgba(13, 20, 35, 0.35);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 2;
}

.guide-toggle {
  height: 64px;
  border: none;
  border-radius: 14px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ecf2ff;
  background: linear-gradient(180deg, #4b6997 0%, #314f7d 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), 0 4px 0 rgba(5, 11, 22, 0.65);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.guide-toggle.active {
  background: linear-gradient(180deg, #4fb4ff 0%, #2f87cf 100%);
}

.guide-text {
  flex: 1;
  border-radius: 16px;
  background: rgba(7, 16, 30, 0.44);
  color: #f4f8ff;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  white-space: pre-line;
  font-size: 34px;
  line-height: 1.45;
  padding: 24px 28px;
  overflow: auto;
}

.guide-line-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

#guideLine {
  stroke: #72d5ff;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0;
}

@media (max-width: 760px) {
  .teaching-board {
    flex-direction: column;
    gap: 20px;
  }

  .calculator {
    width: 100%;
  }

  .guide-panel {
    width: 100%;
    min-height: 240px;
  }

  .guide-toggle {
    height: 56px;
    font-size: 28px;
  }

  .guide-text {
    font-size: 26px;
    min-height: 160px;
  }

  .display {
    font-size: 64px;
  }

  .key {
    height: 66px;
    font-size: 38px;
  }

  .key-small {
    height: 52px;
    font-size: 32px;
  }

  .key-equals {
    height: 66px;
  }
}

/* Web layout: retain large teaching keys while fitting phones and tablets. */
html, body { min-height: 100%; height: auto; }
body { padding: 24px; }
.page { width: min(100%, 1264px); padding: 0; }
.teaching-board { display: grid; grid-template-columns: minmax(0, 700px) minmax(280px, 480px); gap: 36px; }
.calculator { width: 100%; min-width: 0; container-type: inline-size; }
.display { font-size: clamp(20px, 9cqw, 72px); letter-spacing: 1px; }
.guide-panel { width: 100%; min-width: 0; }
.guide-text { font-size: clamp(22px, 2.5vw, 34px); }
.key { min-width: 0; }
.key:focus-visible, .guide-toggle:focus-visible, .display:focus-visible { outline: 3px solid #36b9ef; outline-offset: 4px; }
@media (max-width: 1050px) {
  .teaching-board { grid-template-columns: minmax(0, 700px); justify-content: center; gap: 24px; }
  .guide-panel { min-height: 240px; }
}
@media (max-width: 760px) {
  body { padding: 16px; }
  .calculator { padding: 18px; border-radius: 28px; }
  .display { height: 100px; padding: 0 12px; }
  .keys { gap: 10px; }
  .key { height: 64px; font-size: clamp(24px, 5.6vw, 38px); border-radius: 12px; }
  .key-small { height: 52px; font-size: clamp(18px, 4.5vw, 32px); }
  .top-strip .key-small { min-width: 60px; }
  .solar-panel { width: 30%; height: 30px; }
  .guide-text { min-height: 150px; padding: 18px; }
}
@media (max-width: 400px) {
  body { padding: 10px; }
  .calculator { padding: 12px; border-radius: 22px; }
  .keys { gap: 7px; }
  .key { height: 52px; }
  .key-small { height: 46px; }
  .display-wrap { padding: 8px; }
  .display { height: 82px; padding: 0 8px; }
  .guide-panel { padding: 14px; }
}

