@font-face {
  font-family: "Optician Sans";
  src: url("Optician-Sans.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --text: #050505;
  --muted: #b6b6b6;
  --panel: #f7f7f7;
  --line: #e1e1e1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.page {
  min-height: 100vh;
}

.panel {
  width: min(980px, 95vw);
  margin: 24px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.note {
  margin: 6px 0;
  color: #333;
}

.warning {
  color: #8f3a00;
}

.center-note {
  text-align: center;
  margin: 8px 16px;
}

.Left-note {
  text-align: left;
  margin: 8px 16px;
}
.letter-preview {
  display: grid;
  place-items: center;
  padding: 12px;
  margin: 16px 0 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.calibration-letter {
  font-family: "Optician Sans", sans-serif;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1;
  color: #000;
  user-select: none;
}

.caption {
  margin-top: 10px;
  color: #444;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 500px;
}

label {
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid #bdbdbd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}

.btn {
  border: 1px solid #8f8f8f;
  background: #f4f4f4;
  color: #111;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover {
  background: #ececec;
}

.btn-primary {
  margin-top: 8px;
  background: #111;
  border-color: #111;
  color: #fff;
}

.btn-primary:hover {
  background: #222;
}

.form-message {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 600;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.distance-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.distance-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.readout {
  font-weight: 700;
  min-width: 130px;
}

.clinic-header {
  width: min(1300px, 95vw);
  margin: 10px auto 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfb;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.clinic-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.clinic-logo {
  max-width: 280px;
  width: min(42vw, 280px);
  height: auto;
}

.clinic-text {
  font-size: 0.95rem;
  line-height: 1.35;
}

.clinic-text p {
  margin: 2px 0;
}

.clinic-name {
  font-weight: 700;
}

.disclaimer {
  width: min(1300px, 95vw);
  margin: 6px auto 18px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: #333;
  font-size: 0.92rem;
  line-height: 1.45;
}

.disclaimer p {
  margin: 6px 0;
}

.chart-area {
  min-height: calc(100vh - 130px);
  display: grid;
  place-items: center;
  padding: 12px 8px 24px;
  background: #fff;
}

.rows {
  width: min(1300px, 95vw);
  margin: 0 auto;
}

.chart-row {
  position: relative;
  padding-right: 128px;
}

.letters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--gap, 24px);
  min-width: 0;
  overflow-x: visible;
  overflow-y: visible;
  user-select: none;
  -webkit-user-select: none;
}

.letters.guide-612 {
  position: relative;
}

.letters.guide-612::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 4px;
  background: #e00;
  pointer-events: none;
}

.letter {
  font-family: "Optician Sans", sans-serif;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  letter-spacing: 0;
  line-height: 1;
  color: #000;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.row-label {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  font-size: clamp(0.81rem, 1.15vw, 1.36rem);
  width: 118px;
  text-align: right;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.08;
}

.rows.hide-labels .row-label {
  visibility: hidden;
}

.rows.hide-labels .chart-row {
  padding-right: 0;
}

.row-va {
  color: var(--muted);
}

.row-mm {
  color: #8a8a8a;
  font-size: clamp(0.61rem, 0.81vw, 0.81rem);
  font-weight: 600;
}

@media (max-width: 880px) {
  .clinic-header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .clinic-logo {
    width: min(70vw, 260px);
  }

  .chart-area {
    min-height: calc(100vh - 180px);
  }

  .row-label {
    font-size: clamp(0.64rem, 1.7vw, 0.85rem);
    width: 64px;
  }

  .row-mm {
    font-size: clamp(0.53rem, 1.23vw, 0.66rem);
  }
}
