:root {
  --paper: #f7f5ef;
  --ink: #1d1d1f;
  --muted: #6c6a64;
  --line: #ddd7ca;
  --panel: #fffdf7;
  --accent: #006d77;
  --accent-2: #c7502f;
  --good: #2c7a4b;
  --warn: #b36a00;
  --shadow: 0 18px 50px rgba(36, 31, 22, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  color: var(--ink);
  background: #ebe4d6;
}

.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #f0eadc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  color: white;
  font-weight: 800;
  background: var(--accent-2);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 30px;
}

h3 {
  font-size: 18px;
}

p,
small,
.tips span {
  color: var(--muted);
}

.content {
  padding: 28px;
  overflow: auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.compact {
  display: grid;
  gap: 10px;
  box-shadow: none;
}

.tips {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  box-shadow: none;
}

.tabs {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.tab {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.tab.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.view-head,
.section-title,
.actions,
.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  min-height: 230px;
  margin-top: 12px;
  resize: vertical;
  line-height: 1.6;
}

.upload {
  position: relative;
  display: grid;
  min-height: 126px;
  place-items: center;
  gap: 6px;
  margin: 14px 0 12px;
  border: 1px dashed #b9afa0;
  border-radius: 8px;
  background: #fbf8ef;
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.wide {
  width: 100%;
}

.jsonbox {
  max-height: 200px;
  overflow: auto;
  padding: 12px;
  border-radius: 6px;
  color: #133;
  background: #eef6f4;
  white-space: pre-wrap;
}

.analysis {
  display: grid;
  gap: 12px;
}

.analysis.empty {
  color: var(--muted);
}

.summary {
  padding: 14px;
  border-radius: 6px;
  background: #eef6f4;
}

.decision {
  display: grid;
  grid-template-columns: 72px 1fr 108px;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: white;
  font-size: 13px;
  background: var(--accent-2);
}

.game-list {
  display: grid;
  gap: 12px;
}

.game-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.game-card h3 {
  margin-bottom: 6px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tag {
  padding: 9px 12px;
  border-radius: 999px;
  background: #efe2d5;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  color: white;
  background: #1f2a2a;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .decision,
  .game-card {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }
}
