/* styles for the calculator + analysis pages */

body {
  margin: 0;
  background: #f4f4f4;
  color: #222;
  font-family: system-ui, Arial, sans-serif;
  min-height: 100vh;
}

* { box-sizing: border-box; }

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 16px;
}

h2 { margin: 0; font-size: 16px; }

.setup {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.setup label { font-size: 13px; color: #555; }

.setup input[type="text"] {
  border: 1px solid #bbb;
  padding: 5px 7px;
  font-size: 14px;
  width: 100px;
  border-radius: 3px;
}

.setup button, .analysis-controls button {
  background: #eaeaea;
  border: 1px solid #bbb;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
}

.setup button:hover:not(:disabled),
.analysis-controls button:hover { background: #ddd; }
.setup button:disabled { opacity: 0.5; cursor: not-allowed; }

.run-counter {
  font-size: 13px;
  color: #555;
}

.calculator {
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calculator.hidden { display: none; }

.display {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 12px 14px;
  min-height: 80px;
}

.display .target { font-size: 20px; }
.display .input  { font-size: 15px; color: #2a6fb5; min-height: 20px; }
.display .result { font-size: 15px; color: #2a8a4a; min-height: 20px; }

.session-status {
  font-size: 13px;
  color: #b85c00;
  min-height: 18px;
}

/* keys */
.key {
  width: 64px;
  height: 64px;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 5px;
  font-size: 20px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.key:hover:not(:disabled) { background: #eee; }
.key:active:not(:disabled) { background: #ddd; }
.key:disabled { opacity: 0.5; cursor: not-allowed; }

.keys.layout1 {
  display: flex;
  gap: 8px;
}

/* layout 2: 4x4 with merged ×, ., = */
.keys.layout2 {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  grid-template-rows: repeat(4, 64px);
  gap: 8px;
}

.keys.layout2 .key-multiply {
  grid-column: 4;
  grid-row: 1 / span 2;
  height: 136px;
}

.keys.layout2 .key-dot {
  grid-column: 4;
  grid-row: 3 / span 2;
  height: 136px;
}

.keys.layout2 .key-equals {
  grid-column: 2 / span 2;
  grid-row: 4;
  width: 136px;
}

/* analysis page */
.analysis-page { max-width: 1100px; width: 100%; }

.analysis-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr; }
}

.card {
  background: #fff;
  border: solid 1px #ccc;
  border-radius: 6px;
  padding: 14px;
}

.card canvas {
  background: #fafafa;
  border: 1px solid #eee;
  width: 100%;
  display: block;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  font-size: 13px;
  margin-top: 8px;
}

.stats .label { color: #555; }
.stats .value { text-align: right; }
.empty { color: #999; font-style: italic; }
