* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #f7f5ef;
  color: #222;
  font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
}

nav { display: flex; gap: 6px; }

button {
  font: inherit;
  padding: 8px 14px;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #fff;
  color: #222;
}

button.active { background: #2f5d50; border-color: #2f5d50; color: #fff; }

.opt { display: flex; align-items: center; gap: 6px; }

main { flex: 1; min-height: 0; display: flex; }

.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.choices { display: flex; gap: 6px; flex-wrap: wrap; }

.status { color: #555; }

.padwrap { flex: 1; min-height: 0; padding: 0 12px; }

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  touch-action: none;
}

.scroll { flex: 1; overflow: auto; padding: 0 12px 12px; }

table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { border: 1px solid #ddd; padding: 6px 8px; text-align: right; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }

.info {
  margin: 8px 12px 12px;
  padding: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
}
