:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --line: #cfd6e3;
  --line-strong: #111111;
  --text: #111111;
  --muted: #5d6878;
  --call: #e34b3f;
  --put: #2563eb;
  --spot: #111111;
  --base: #f4e0cf;
  --yellow: #fff135;
  --green: #92d050;
  --orange: rgb(253, 233, 217);
  --blue: #dbe5f1;
  --gray: #e7e6e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: #000000;
}

.page {
  max-width: 100%;
  margin: 0 auto;
  padding: 2px 2px 8px;
}

.board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  align-items: start;
  justify-items: center;
  background: #000;
}

.chart-panel,
.sidebar-panel,
.table-panel {
  min-height: 0;
  width: min(96vw, 1400px);
}

.chart-panel {
  width: min(86vw, 980px);
}

.sidebar-panel {
  width: min(96vw, 720px);
}

.chart-panel {
  background: #fff;
  border: 2px solid #111;
}

.sidebar-panel {
  padding: 2px 0 0;
  background: #000;
  color: #fff;
  border: 2px solid #111;
}

.table-panel {
  background: #fff;
  border: 2px solid #111;
}

.chart {
  min-width: 390px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.chart-controls {
  display: grid;
  gap: 6px;
  padding: 8px 8px 6px;
  background: #f7f3e6;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
}

.chart-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-action-btn {
  padding: 4px 10px;
  border: 1px solid #111;
  background: #fff7c2;
  color: #111;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chart-action-btn.active {
  background: #fca5a5;
}

.chart-action-btn-muted {
  background: #e5e7eb;
}

.chart-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #111;
}

.chart-control-label {
  white-space: nowrap;
}

.chart-control-input {
  width: 88px;
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  font: inherit;
}

.chart-control-line .chart-control-label {
  min-width: 24px;
  text-align: right;
}

.line-input {
  width: 72px;
}

.line-color-select {
  width: 88px;
  background: #fff;
}

.chart-head {
  display: grid;
  grid-template-columns: 56px repeat(17, minmax(41px, 1fr));
  border-bottom: 2px solid #2b9348;
}

.chart-corner,
.chart-strike {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 700;
}

.chart-strike {
  background: var(--yellow);
}

.chart-strike.base {
  background: var(--base);
}

.chart-body {
  position: relative;
  display: grid;
  grid-template-columns: 56px repeat(17, minmax(41px, 1fr));
}

.y-label {
  height: 20px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid #aeb7c3;
  padding-right: 6px;
  text-align: right;
  font-size: 10px;
  line-height: 20px;
  color: #4b5563;
  background: #ffffff;
}

.y-label.emphasis-red {
  border-bottom-color: #e11d48;
  border-bottom-width: 2px;
}

.y-label.emphasis-blue {
  border-bottom-color: #2563eb;
  border-bottom-width: 2px;
}

.cell {
  height: 20px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid #aeb7c3;
  background: #ffffff;
}

.cell.base {
  background: rgba(244, 224, 207, 0.72);
}

.cell.emphasis-red {
  border-bottom-color: #e11d48;
  border-bottom-width: 2px;
}

.cell.emphasis-blue {
  border-bottom-color: #2563eb;
  border-bottom-width: 2px;
}

.plot-layer {
  position: absolute;
  inset: 0 0 0 56px;
  pointer-events: auto;
  cursor: crosshair;
}

.plot-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.legend {
  display: flex;
  gap: 14px;
  padding: 6px 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.summary {
  display: grid;
  gap: 1px;
  background: #000;
  padding-bottom: 0;
}

.summary-row {
  display: grid;
  gap: 1px;
}

.summary-row.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-item {
  min-height: 42px;
  padding: 6px 4px;
  background: #ffffff;
}

.summary-label {
  margin-bottom: 2px;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.summary-value {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.summary-item.blank {
  background: #000;
  min-height: 28px;
}

.summary-item.header-gray {
  background: var(--gray);
}

.label-orange { background: var(--orange); }
.label-blue { background: var(--blue); }
.label-gray { background: var(--gray); }
.label-base { background: var(--base); }
.yellow { background: var(--yellow); }
.green { background: var(--green); }
.up { color: var(--call); }
.down { color: var(--put); }

.table-wrap {
  padding: 0;
  overflow-x: auto;
}

.table-shell {
  min-width: 0;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border: 1px solid var(--line);
  padding: 5px 4px;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
  color: #111111;
}

thead th {
  border-color: var(--line-strong);
  font-weight: 700;
  background: #f7f3e6;
}

.vstrong {
  border-right: 2px solid var(--line-strong) !important;
}

.hstrong td {
  border-bottom: 2px solid var(--line-strong);
}

.strike-center {
  color: #111111;
  font-weight: 700;
}

.base-strike-row td {
  background: #fff8b0;
}

.empty {
  color: #9aa4b2;
}

.body-table td.up,
.body-table td.down,
.body-table .up,
.body-table .down {
  color: #111111 !important;
}

.chart-caption {
  display: none;
}

.summary-wrap {
  background: #000;
  padding: 0 0 0 0;
}

.memo-cell {
  padding: 2px;
  background: #f7f7f7;
}

.memo-cell-input {
  width: 100%;
  min-width: 64px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: center;
  outline: none;
}

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

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page {
    padding-left: 1px;
    padding-right: 1px;
  }

  .chart-controls {
    flex-wrap: wrap;
  }

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
