:root {
  color-scheme: light;
  --bg: #f7faf9;
  --panel: #ffffff;
  --panel-strong: #f1f6f5;
  --line: #dce6e4;
  --text: #172026;
  --muted: #66737a;
  --accent: #00a98f;
  --accent-strong: #007e70;
  --shadow: 0 24px 70px rgba(28, 55, 62, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(0, 169, 143, 0.08), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto;
}

.app-panel {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(300px, 340px);
  gap: 16px 28px;
  min-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 24px 28px;
}

.brand-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 50px);
  line-height: 0.95;
  letter-spacing: 0;
}

.status-pill {
  display: grid;
  place-items: center;
  min-width: 78px;
  height: 48px;
  border: 1px solid rgba(0, 169, 143, 0.34);
  border-radius: 8px;
  background: rgba(0, 169, 143, 0.08);
  color: var(--accent-strong);
  font-size: 24px;
  font-weight: 900;
}

.selector-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.selector-block {
  min-width: 0;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.letter-grid,
.number-grid {
  display: grid;
  gap: 7px;
}

.letter-grid {
  grid-template-columns: repeat(13, minmax(38px, 1fr));
}

.number-grid {
  grid-template-columns: repeat(11, minmax(42px, 1fr));
}

.letter-grid button,
.number-grid button,
.copy-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.letter-grid button,
.number-grid button {
  min-width: 0;
  font-size: 16px;
}

.letter-grid button {
  min-height: 36px;
}

.number-grid button {
  min-height: 42px;
}

.letter-grid button:hover,
.number-grid button:hover,
.copy-button:hover {
  border-color: rgba(0, 169, 143, 0.52);
  background: #eaf7f5;
}

.letter-grid button:active,
.number-grid button:active,
.copy-button:active {
  transform: translateY(1px);
}

.letter-grid button.is-selected,
.number-grid button.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.result-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-content: start;
  min-width: 0;
  margin-top: 0;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.url-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 14px;
  align-items: center;
  min-width: 0;
}

#fileNameLabel {
  overflow: hidden;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#imageLink {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

#fullPath {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.copy-button {
  min-height: 52px;
  width: 100%;
}

.qr-stage {
  display: grid;
  place-items: center;
  order: -1;
}

#qrCanvas {
  width: min(100%, 288px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

@media (max-width: 940px) {
  .app-panel {
    grid-template-columns: 1fr;
  }

  .letter-grid {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
  }

  .number-grid {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
  }

  .result-panel {
    padding-top: 24px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .qr-stage {
    justify-items: start;
    order: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    margin: 10px auto;
  }

  .app-panel {
    padding: 18px;
  }

  .brand-row {
    align-items: center;
  }

  .url-card {
    grid-template-columns: 1fr;
  }
}
