:root {
  --text: #050505;
  --muted: #575757;
  --border: #a2a2a2;
  --button: #f2f2f2;
  --button-active: #232323;
  --button-active-text: #ffffff;
  --focus: #7a2df0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.page-shell {
  width: min(1200px, calc(100vw - 64px));
  margin: 44px 0 80px 48px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.logo {
  width: clamp(150px, 18vw, 220px);
  aspect-ratio: 1;
  object-fit: contain;
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.object-form {
  max-width: 1060px;
}

.lead {
  margin: 0 0 32px;
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.28;
}

.lead span {
  font-style: italic;
}

.letter-panel {
  margin-bottom: 32px;
}

.letter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.letter-button {
  min-width: 52px;
  height: 52px;
  padding: 0 10px;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--button);
  color: #202020;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.letter-button:disabled {
  color: #a0a0a0;
  border-color: #d0d0d0;
  cursor: not-allowed;
}

.letter-button:not(:disabled):hover,
.letter-button:not(:disabled):focus-visible {
  border-color: var(--focus);
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 2px;
}

.letter-button.is-active {
  background: var(--button-active);
  border-color: var(--button-active);
  color: var(--button-active-text);
}

.review h2 {
  margin: 0 0 32px;
  font-size: clamp(26px, 2.5vw, 34px);
  font-weight: 400;
  letter-spacing: 0;
}

.list-box {
  width: min(100%, 920px);
  min-height: 132px;
  max-height: 430px;
  overflow: auto;
  border: 2px solid var(--border);
  padding: 12px;
  font-size: 18px;
  line-height: 1.25;
  color: var(--text);
}

.empty-state {
  color: var(--muted);
}

.file-link {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 54px;
  max-width: 100%;
  border: 1px solid #d6d6d6;
  padding: 7px 9px;
  background: #fbfbfb;
  color: #111111;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.file-count {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 17px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.file-name {
  font-size: 17px;
  font-weight: 700;
}

.file-group {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.file-link:hover,
.file-link:focus-visible {
  border-color: var(--focus);
  color: #5b19cf;
  outline: none;
}

.download-button {
  background-color: DodgerBlue;
  color: white;
  border: none;
  padding: 5px 30px;
  cursor: pointer;
  font-size: 20px;
  border-radius: 5px;
}

.download-button:disabled {
  color: #777777;
  cursor: not-allowed;
  opacity: 0.65;
}

.chart-section {
  width: min(100%, 920px);
  margin-top: 34px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.chart-header h2 {
  margin: 0;
  font-size: clamp(26px, 2.5vw, 34px);
  font-weight: 400;
  letter-spacing: 0;
}

.file-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  cursor: pointer;
}

.file-loader input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chart-status {
  min-height: 26px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.3;
}

#lightCurveCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  border: 2px solid var(--border);
  background: #ffffff;
}

.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: #202020;
  font-size: 18px;
}

.chart-stat {
  border: 1px solid #d8d8d8;
  padding: 5px 9px;
  background: #f8f8f8;
}

.photometry-section {
  width: min(100%, 920px);
  margin-top: 30px;
}

.photometry-section h2 {
  margin: 0 0 12px;
  font-size: clamp(26px, 2.5vw, 34px);
  font-weight: 400;
  letter-spacing: 0;
}

.photometry-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 2px solid var(--border);
  background: #ffffff;
}

.photometry-table-wrap .empty-state {
  margin: 0;
  padding: 12px;
  font-size: 18px;
}

.photometry-raw {
  margin: 0;
  min-width: max-content;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.35;
  white-space: pre;
  tab-size: 8;
}

.download-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 28px, 680px);
    margin: 24px auto 56px;
  }

  .hero {
    align-items: flex-start;
    gap: 12px;
  }

  .logo {
    width: 96px;
  }

  h1 {
    padding-top: 24px;
  }

  .lead {
    margin-bottom: 24px;
    font-size: 24px;
  }

  .letter-buttons {
    gap: 10px;
  }

  .letter-button {
    min-width: 48px;
    height: 48px;
    font-size: 30px;
  }

  .review h2 {
    margin-bottom: 18px;
  }

  .list-box {
    font-size: 20px;
  }

  .chart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-status {
    font-size: 18px;
  }

  .photometry-raw {
    font-size: 14px;
  }
}
