:root {
  color-scheme: light;
  --bg: #fffdf9;
  --panel: #fffaf5;
  --text: #211814;
  --muted: #7a6254;
  --line: #eed7c0;
  --accent: #ff7900;
  --accent-dark: #d85f00;
  --accent-soft: #fff2e6;
  --accent-wash: #fff8f0;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(123, 69, 18, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.home-page {
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 238, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: color 160ms ease;
}

.home-shell,
.tool-shell {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
}

.home-shell {
  padding: 72px 0;
}

.home-page .site-header {
  height: 104px;
  padding: 0 82px;
  background: #f6f2ee;
  backdrop-filter: none;
}

.home-page .brand {
  font-size: 28px;
}

.home-page .home-shell {
  width: calc(100% - 140px);
  max-width: none;
  padding: 72px 0;
}

.home-shell h1,
.tool-title h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.home-page .home-shell h1 {
  font-size: clamp(42px, 4.8vw, 68px);
  font-weight: 800;
}

.tool-list {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf9;
  box-shadow: var(--shadow);
}

.home-page .tool-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.tool-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  transition: background 160ms ease, color 160ms ease;
}

.home-page .tool-row {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  border: 1px solid #f0dac4;
  border-radius: 8px;
  background: var(--accent-wash);
  box-shadow: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tool-row:hover {
  background: var(--accent-soft);
}

.home-page .tool-row:hover {
  border-color: #ffb36e;
  background: #fff7ed;
  box-shadow: 0 18px 40px rgba(123, 69, 18, 0.08);
  transform: translateY(-2px);
}

.tool-row span {
  font-weight: 700;
}

.home-page .tool-name {
  color: var(--text);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.tool-row small {
  color: var(--muted);
  font-size: 14px;
}

.tool-row b {
  color: var(--accent);
  font-size: 14px;
}

.tool-shell {
  padding: 36px 0 44px;
}

.tool-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.tool-title p {
  margin: 0;
  color: var(--muted);
}

.workspace {
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-wrap {
  position: relative;
}

.editor-wrap textarea {
  display: block;
  width: 100%;
  min-height: min(58vh, 620px);
  resize: vertical;
  padding: 24px;
  border: 0;
  outline: 2px solid transparent;
  outline-offset: -2px;
  background: #fffdf9;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

.editor-wrap textarea::placeholder {
  color: #ad907c;
}

.editor-wrap textarea:focus {
  outline-color: var(--accent);
}

.line-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 82px;
  padding: 9px 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, max-content) 1fr minmax(180px, 260px);
  gap: 16px 22px;
  align-items: center;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: var(--accent-wash);
}

.field,
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.field input[type="number"] {
  width: 92px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #e6c9ad;
  border-radius: 4px;
  background: #fffdf9;
  color: var(--text);
}

.field input[type="number"]:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(255, 121, 0, 0.16);
  outline-offset: 0;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-btn,
.plain-btn {
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.primary-btn:active,
.plain-btn:active {
  transform: translateY(1px);
}

.utility-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 18px;
  background: var(--accent-wash);
}

.plain-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fffdf9;
  color: var(--muted);
}

.plain-btn:hover {
  border-color: #ffb36e;
  color: var(--text);
}

.status {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.issues {
  margin: 0;
  padding: 0 20px 18px 42px;
  color: var(--danger);
}

.issues:empty {
  display: none;
}

@media (max-width: 1180px) {
  .home-page .home-shell {
    width: calc(100% - 48px);
  }

  .home-page .tool-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header {
    height: 56px;
  }

  .home-shell {
    padding: 44px 0;
  }

  .home-page .site-header {
    height: 76px;
    padding: 0 24px;
  }

  .home-page .brand {
    font-size: 22px;
  }

  .home-page .home-shell {
    width: calc(100% - 32px);
    padding: 32px 0;
  }

  .home-page .home-shell h1 {
    font-size: 42px;
  }

  .home-page .tool-list {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 28px;
  }

  .tool-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 18px;
  }

  .home-page .tool-row {
    min-height: 176px;
    gap: 18px;
    padding: 24px;
  }

  .home-page .tool-name {
    font-size: 24px;
  }

  .tool-row small {
    grid-column: 1 / -1;
  }

  .tool-title {
    align-items: start;
    flex-direction: column;
  }

  .editor-wrap textarea {
    min-height: 52vh;
    padding: 18px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .field,
  .check-field,
  .primary-btn {
    width: 100%;
  }

  .field {
    justify-content: space-between;
  }

  .field input[type="number"] {
    width: 120px;
  }

  .utility-bar {
    flex-wrap: wrap;
  }

  .status {
    flex-basis: 100%;
    margin-left: 0;
    text-align: left;
  }
}
