﻿:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --line: #d8e0ea;
  --text: #1f2937;
  --muted: #667085;
  --accent: #2463eb;
  --accent-hover: #1e54c9;
  --accent-pressed: #1848b2;
  --error-bg: #fff2f0;
  --error-line: #efb4ad;
  --shadow: 0 18px 50px rgba(27, 39, 51, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 99, 235, 0.10), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: hidden;
}

.page {
  padding: 16px;
  min-height: 100vh;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
}

.app-shell {
  display: grid;
  grid-template-columns: 400px 630px;
  gap: 12px;
  justify-content: center;
  align-items: stretch;
  height: var(--two-col-height, auto);
}

.main-panel,
.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.main-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.settings-panel {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.settings-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px 8px 4px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.generate-btn,
.secondary-btn {
  border: 0;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.generate-btn {
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
}

.generate-btn:hover { background: var(--accent-hover); }
.generate-btn:active { background: var(--accent-pressed); }
.generate-btn:disabled { opacity: 0.7; cursor: progress; }

.secondary-btn {
  background: #edf3ff;
  color: #244279;
  padding: 8px 13px;
}

.secondary-btn:hover { background: #dfeafe; }

.error-box {
  padding: 10px 12px;
  border: 1px solid var(--error-line);
  background: var(--error-bg);
  border-radius: 12px;
  font-size: 14px;
}

.main-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  width: 100%;
}

.row-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
}

.main-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 74px;
  flex: 1 1 0;
}

.main-text textarea,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.field input,
.field select {
  min-height: 20px;
}

.main-text textarea {
  resize: none;
  height: 0;
  min-height: 50px;
  max-height: none;
  line-height: 1.35;
  flex: 1 1 auto;
  font-size: 15px;
}

#words {
  min-height: 50px;
  max-height: none;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.field > label,
.main-text > label {
  font-size: 13px;
  font-weight: 400;
}

.main-panel .field > label,
.main-text > label {
  font-size: 14px;
  font-weight: 600;
}

.main-panel .title-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.main-panel .title-field > label {
  flex: 0 0 auto;
}

.main-panel .title-field .control {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-panel .field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.settings-panel .field > label {
  flex: 0 0 auto;
  white-space: nowrap;
}

.control {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.control.wide input { flex: 1; }

.settings-panel .control {
  flex-wrap: nowrap;
}

.settings-panel .field input:not([type="checkbox"]) {
  width: 36px;
  flex: 0 0 36px;
}

.settings-panel .field select {
  width: 56px;
  flex: 0 0 56px;
}

.settings-panel .field select.short-select {
  width: 46px;
  flex-basis: 46px;
}

.settings-panel .field.repeat-field select.short-select {
  width: 46px;
  flex-basis: 46px;
}

.settings-panel .field.repeat-field .control {
  gap: 0;
}

.settings-panel .field.repeat-field .repeat-mid {
  margin-right: 4px;
}

.settings-panel .field select.medium-select {
  width: 90px;
  flex-basis: 90px;
}

.settings-panel .field select.font-select {
  width: 66px;
  min-width: 66px;
  flex: 0 0 66px;
}

.settings-panel .field select.page-size-select {
  width: 50px;
  flex-basis: 50px;
}

.unit {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 400;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 18px;
  font-size: 13px;
  line-height: 1.2;
}

.check input {
  margin: 0;
  inline-size: 12px;
  block-size: 12px;
}
.checkbox-field { align-self: center; }
.plain-text .control { min-height: 24px; }
.compact-checks { flex-wrap: wrap; gap: 8px; }
.guides-types { min-width: 0; }
.bottom-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.bottom-actions .generate-btn {
  margin-left: auto;
}

.brightness-row {
  justify-content: flex-start;
}

.brightness-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.brightness-group .field {
  gap: 4px;
}

.settings-group + .settings-group { margin-top: 16px; }

.settings-group > .row-grid + .row-grid {
  margin-top: 12px;
}

.settings-group h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  height: 0;
  padding: 0 14px 0 0;
  margin-top: 0;
  overflow: visible;
}

.info-fab {
  margin-top: -28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f8fd;
  color: #27426e;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.10);
}

.info-fab:hover {
  background: #eaf1ff;
}

.about-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.about-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.about-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #edf1f6;
}

.about-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.about-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.about-body {
  padding: 14px 18px 18px;
  font-size: 14px;
  line-height: 1.55;
}

.about-body h3 {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.about-body p {
  margin: 0;
}

.about-body p + p,
.about-body p + h3,
.about-body ul + h3,
.about-body ul + p {
  margin-top: 10px;
}

.about-body ul {
  margin: 0;
  padding-left: 18px;
}

.about-body li + li {
  margin-top: 6px;
}

.about-body a {
  color: var(--accent);
  text-decoration: none;
}

.about-body a:hover {
  text-decoration: underline;
}

.about-body code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95em;
  background: #f4f7fb;
  border: 1px solid #e4ebf3;
  border-radius: 5px;
  padding: 1px 4px;
}

@media (max-width: 1080px) {
  body {
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .page {
    min-height: 100vh;
    height: 100vh;
  }

  .app-shell {
    grid-template-columns: minmax(400px, 630px);
    height: auto;
    min-height: 0;
    justify-content: center;
  }

  .main-panel,
  .settings-panel {
    width: 100%;
    max-width: 630px;
    margin-left: auto;
    margin-right: auto;
  }

  .main-panel {
    display: block;
    overflow: visible;
  }

  .main-panel > * + * {
    margin-top: 10px;
  }

  .main-text {
    display: block;
  }

  .main-text > label {
    display: block;
    margin-bottom: 5px;
  }

  .main-text textarea {
    display: block;
    width: 100%;
    flex: none;
    height: 50px;
    min-height: 50px;
    max-height: 50px;
  }

  #words {
    height: 50px;
    min-height: 50px;
    max-height: 50px;
  }

  .settings-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .settings-scroll {
    height: auto;
    overflow: visible;
    padding: 0;
  }
}

@media (max-width: 860px) {
  .row-grid {
    gap: 12px 18px;
  }

  .bottom-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .generate-btn,
  .secondary-btn {
    width: auto;
  }
}
