/* 分数计算器 — 仅本页样式（外观参照手机上的「分数计算器」：金属机身、蓝色液晶、三组按键） */

.fc-wrap { max-width: 520px; margin: 1rem auto 2rem; padding: 0 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.fc-head { margin-bottom: .75rem; }
.fc-title { margin: 0; font-size: 1.5rem; color: var(--text-primary, #1a1a1a); }
.fc-sub { margin: .3rem 0 0; font-size: .88rem; line-height: 1.5; color: var(--text-secondary, #666); }

.fc-calc {
  position: relative;
  padding: 12px;
  border-radius: 16px;
  background: repeating-linear-gradient(90deg, #d9dadc 0 2px, #cfd0d3 2px 4px), linear-gradient(#e2e3e5, #c9cacd);
  background-blend-mode: multiply;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

/* 液晶屏 */
.fc-display {
  position: relative;
  min-height: 118px;
  padding: 8px 64px 8px 12px;
  border: 3px solid #5d6770;
  border-radius: 4px;
  background: linear-gradient(#8cc4d8, #74b3cb);
  color: #111;
  overflow: hidden;
}
.fc-decimal { text-align: right; font-size: 1.15rem; color: #1d2b33; min-height: 1.4em; }
.fc-line {
  display: flex; align-items: center; justify-content: flex-end; gap: .12em;
  white-space: nowrap; overflow: hidden;
  font-size: 44px; line-height: 1.15; font-weight: 300; min-height: 1.3em;
}
.fc-line-in { display: inline-flex; align-items: center; gap: .12em; flex: none; }
.fc-line .tok { display: inline-flex; align-items: center; gap: .08em; }
.fc-line .op { padding: 0 .12em; color: #2a3a44; }
.fc-line .res { font-weight: 400; }
.fr { display: inline-flex; flex-direction: column; align-items: center; font-size: .5em; line-height: 1.05; margin-left: .05em; }
.fr-n { border-bottom: .08em solid currentColor; padding: 0 .12em; }
.fr-d { padding: 0 .12em; }
.fr-partial .fr-n, .fr-partial .fr-d { opacity: .75; }
.fc-note { min-height: 1.3em; text-align: right; font-size: .95rem; color: #1d3440; }
.fc-note .fr { font-size: .8em; }
.fc-note.fc-err { color: #a3170f; font-weight: 600; }
.fc-hist-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9); background: rgba(60, 90, 105, .55); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* 历史 */
.fc-hist { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f7f8fa; border: 1px solid #c9ced4; max-height: 240px; overflow: auto; }
.fc-hist.hidden { display: none; }
.fc-hist-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 4px; }
.fc-hist-head button { border: 0; background: none; color: #b0271d; cursor: pointer; font-size: .9rem; }
.fc-hist ol { margin: 0; padding: 0; list-style: none; }
.fc-hist li { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .1em; padding: 6px 4px; border-top: 1px solid #e3e6ea; font-size: 22px; cursor: pointer; }
.fc-hist li .op { padding: 0 .12em; }
.fc-hist-empty { margin: 4px 0; color: #777; font-size: .9rem; }

/* 按键区：左 2 列整数，右 3 列分子/分母 */
.fc-pads { display: grid; grid-template-columns: 2fr 3.1fr; gap: 14px; margin-top: 12px; }
.fc-pad { display: grid; gap: 8px; }
.fc-whole { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.fc-frac { display: flex; flex-direction: column; gap: 8px; }
.fc-num, .fc-den { grid-template-columns: repeat(3, 1fr); }
.k-wide { grid-column: span 2; }
.fc-bar { height: 6px; margin: 2px 4px; border-radius: 3px; background: linear-gradient(#f4f4f4, #9a9ea3); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

.k {
  min-height: 48px;
  border: 0; border-radius: 9px; cursor: pointer;
  font-size: 1.7rem; line-height: 1; color: #1a1a1a;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .05s, box-shadow .05s;
}
.k:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .6); }
.fc-whole .k { background: linear-gradient(#b9c4cc, #8d9aa4); }
.fc-num .k, .fc-den .k { background: linear-gradient(#d9d8cd, #b8b6a6); }
.k-clear { background: linear-gradient(#f27d73, #d9463c) !important; color: #fff; }
.k-fn { background: linear-gradient(#dfe3ef, #b9bfd0) !important; font-size: 1.35rem; }
.k-bs { font-size: 1.4rem; }

.fc-ops { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.k-op { background: linear-gradient(#e2e6ee, #b7bfcc); font-size: 1.9rem; }
.k-eq { background: linear-gradient(#f9b367, #ec8b2f); color: #fff; font-size: 1.9rem; }

.fc-foot { margin-top: .9rem; font-size: .82rem; line-height: 1.55; color: var(--text-secondary, #666); }

@media (min-width: 560px) {
  .k { min-height: 56px; }
  .fc-line { font-size: 52px; }
}
