:root {
  --bg: #f4f4f2;
  --card: #ffffff;
  --ink: #202124;
  --muted: #9c9c9c;
  --line: #eeeeea;
  --line-strong: #ded8ca;
  --top: #f6d764;
  --top-deep: #e8bd34;
  --gold: #d9a83b;
  --gold-soft: #fff8e8;
  --red: #d95a46;
  --red-soft: #fff1eb;
  --green: #4c7a58;
  --shadow: 0 8px 22px rgba(45, 38, 22, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: #eeeeee;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.page {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 28px;
  background: var(--bg);
}

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 86px;
  margin: 0 -16px 16px;
  padding: 22px 16px 14px;
  background: var(--top);
  border-bottom: 1px solid rgba(155, 121, 38, 0.16);
}

.site-head::before {
  content: "<";
  position: absolute;
  left: 20px;
  top: 29px;
  color: #262115;
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}

.brand-title {
  margin: 0;
  color: #15130f;
  text-align: center;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: 0;
  font-weight: 750;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: rgba(32, 28, 18, 0.58);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.top-link {
  position: absolute;
  right: 18px;
  top: 31px;
  color: #2b2618;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.panel {
  margin-top: 12px;
  padding: 18px 16px;
  border: 1px solid rgba(232, 225, 209, 0.75);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 16px;
  color: #262626;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 750;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field.full,
.check-field {
  grid-column: 1 / -1;
}

.field label,
label {
  color: #3a3426;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #eee6d5;
  border-radius: 8px;
  padding: 10px 12px;
  color: #252525;
  background: #fffdf8;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 168, 59, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: #c3bba9;
}

textarea {
  min-height: 126px;
  resize: vertical;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #f0e8d9;
  border-radius: 8px;
  background: var(--gold-soft);
}

.check-field input {
  width: 17px;
  min-height: 17px;
}

.check-field span {
  color: #6d5b2b;
  font-size: 13px;
  font-weight: 650;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.primary,
.secondary,
.ghost {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 750;
}

.primary {
  width: 100%;
  border: 0;
  color: #3d2b0d;
  background: linear-gradient(180deg, #f8dc74 0%, #e8bd34 100%);
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(184, 135, 31, 0.2);
}

.secondary {
  border: 1px solid #f1d2c8;
  color: var(--red);
  background: var(--red-soft);
}

.ghost {
  min-height: 34px;
  border: 1px solid #efdfc6;
  color: #a86f19;
  background: #fffaf0;
  font-size: 13px;
}

.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rows {
  display: grid;
  gap: 10px;
}

.empty-ok:empty::before {
  content: "";
  display: block;
  min-height: 4px;
}

.row-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(41, 31, 16, 0.035);
}

.row-item .row-title span:first-child {
  color: #242424;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 750;
}

.row-item .row-title span:last-child {
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.row-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.great-lines {
  display: grid;
  gap: 8px;
}

.great-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 2px 0 9px;
  border-bottom: 1px solid #f0e7d5;
}

.great-line:last-child {
  border-bottom: 0;
}

.great-line.current-line {
  padding: 8px 8px 11px;
  border: 1px solid #f1d38a;
  border-radius: 8px;
  background: #fff9e8;
}

.great-line-text {
  color: #241d11;
  font-size: 15px;
  line-height: 1.65;
}

.ghost.mini {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.great-line .reading-box {
  grid-column: 1 / -1;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.result-head h2 {
  margin: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 8px 0 14px;
  padding: 5px;
  border: 1px solid #eee5d2;
  border-radius: 8px;
  background: #fffaf0;
}

.tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: #7e7663;
  background: transparent;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 750;
  cursor: pointer;
}

.tabs button.active {
  color: #3b2a0a;
  background: var(--top);
}

.sub-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(232, 225, 209, 0.75);
  border-radius: 8px;
  background: #fff;
}

.sub-panel + .sub-panel {
  margin-top: 12px;
}

.sub-panel h3 {
  margin: 0 0 2px;
  color: #2a2925;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 780;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.summary-card,
.luck-card {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #f1e8d7;
  border-radius: 8px;
  background: #fffdf8;
}

.summary-card span,
.luck-card span {
  display: block;
  color: #a5a092;
  font-size: 12px;
}

.summary-card strong,
.luck-card strong {
  display: block;
  margin-top: 5px;
  color: #2d2a22;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.table-box {
  overflow: hidden;
  border: 1px solid #eee5d2;
  border-radius: 8px;
  background: #fff;
}

.table-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #f2eadb;
}

.table-row:first-child {
  border-top: 0;
}

.table-row > div {
  min-height: 42px;
  padding: 9px 5px;
  border-left: 1px solid #f2eadb;
  color: #5d594e;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.table-row > div:first-child {
  border-left: 0;
}

.table-head > div {
  color: #3a2d11;
  background: var(--gold-soft);
  font-weight: 800;
}

.strong > div {
  color: #26231c;
  font-weight: 800;
}

.locked {
  margin-top: 10px;
  padding: 12px;
  color: #805100;
  border: 1px solid #f4deb0;
  border-radius: 8px;
  background: #fff6df;
  font-size: 13px;
  line-height: 1.6;
}

.notice {
  padding: 12px;
  border: 1px solid #f3ddc8;
  border-radius: 8px;
  color: #7f3a2e;
  background: var(--red-soft);
  font-size: 13px;
  line-height: 1.65;
}

.hidden {
  display: none !important;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 70vh;
  overflow: auto;
}

.admin-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

@media (min-width: 700px) {
  body {
    background: #eeeeee;
  }

  .page {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.025);
  }
}

@media (max-width: 390px) {
  .page {
    padding: 0 12px 22px;
  }

  .site-head {
    margin: 0 -12px 14px;
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs button:last-child {
    grid-column: 1 / -1;
  }

  .table-row > div {
    font-size: 11px;
    padding: 8px 3px;
  }
}
