.gh-app {
  --gh-bg: #f7f8fb;
  --gh-surface: #ffffff;
  --gh-line: #d9dee8;
  --gh-text: #172033;
  --gh-muted: #667085;
  --gh-primary: #2457c5;
  --gh-primary-ink: #ffffff;
  --gh-danger: #b42318;
  --gh-ok: #067647;
  --gh-warn-bg: #fff7d6;
  --gh-warn-line: #f2d46b;
  background: var(--gh-bg);
  border: 1px solid var(--gh-line);
  color: var(--gh-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 24px 0;
  overflow: hidden;
}

.gh-app *,
.gh-app *::before,
.gh-app *::after {
  box-sizing: border-box;
}

.gh-topbar,
.gh-section-head,
.gh-actions,
.gh-form,
.gh-layout,
.gh-ocr-grid {
  display: flex;
  gap: 12px;
}

.gh-topbar {
  align-items: center;
  background: #122033;
  color: #fff;
  justify-content: space-between;
  padding: 18px 20px;
}

.gh-kicker {
  color: #aec4f7;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.gh-topbar h2,
.gh-section-head h3,
.gh-alert h4 {
  margin: 0;
}

.gh-topbar h2 {
  font-size: 22px;
}

.gh-panel {
  padding: 18px;
}

.gh-form {
  align-items: end;
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
}

.gh-form label,
.gh-ocr-grid label {
  display: grid;
  flex: 1 1 150px;
  gap: 6px;
}

.gh-form span,
.gh-ocr-grid span {
  color: var(--gh-muted);
  font-size: 13px;
}

.gh-app input,
.gh-app select,
.gh-app textarea {
  background: #fff;
  border: 1px solid #c8cfda;
  border-radius: 6px;
  color: var(--gh-text);
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.gh-app textarea {
  min-height: 140px;
  resize: vertical;
}

.gh-button {
  align-items: center;
  background: #eef2f7;
  border: 1px solid #c8cfda;
  border-radius: 6px;
  color: var(--gh-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
}

.gh-button:hover,
.gh-button.is-active {
  background: #dfe7f3;
}

.gh-button-primary {
  background: var(--gh-primary);
  border-color: var(--gh-primary);
  color: var(--gh-primary-ink);
}

.gh-button-primary:hover {
  background: #1c46a3;
}

.gh-button-danger {
  background: #fff1f0;
  border-color: #f2b8b5;
  color: var(--gh-danger);
}

.gh-button-small {
  font-size: 13px;
  min-height: 32px;
  padding: 6px 9px;
}

.gh-layout {
  align-items: flex-start;
}

.gh-list {
  flex: 0 0 300px;
}

.gh-detail {
  flex: 1 1 auto;
  min-width: 0;
}

.gh-list,
.gh-detail,
.gh-panel > .gh-section-head,
.gh-table-wrap,
.gh-ocr-text {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-radius: 8px;
}

.gh-list,
.gh-detail {
  padding: 14px;
}

.gh-section-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.gh-section-head p,
.gh-muted {
  color: var(--gh-muted);
  margin: 4px 0 0;
}

.gh-stack {
  display: grid;
  gap: 8px;
}

.gh-game-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--gh-line);
  border-radius: 8px;
  color: var(--gh-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.gh-game-item small,
.gh-game-item em {
  color: var(--gh-muted);
  display: block;
  font-size: 12px;
  font-style: normal;
}

.gh-game-item.is-selected {
  border-color: var(--gh-primary);
  box-shadow: inset 3px 0 0 var(--gh-primary);
}

.gh-table-wrap {
  overflow-x: auto;
}

.gh-table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.gh-table th,
.gh-table td {
  border-bottom: 1px solid var(--gh-line);
  padding: 9px;
  text-align: left;
  vertical-align: middle;
}

.gh-table th {
  background: #f1f4f8;
  color: #344054;
  font-size: 13px;
}

.gh-alert {
  background: var(--gh-warn-bg);
  border: 1px solid var(--gh-warn-line);
  border-radius: 8px;
  margin: 12px 0;
  padding: 12px;
}

.gh-alert p {
  margin: 6px 0;
}

.gh-alert ul {
  margin: 6px 0 0 18px;
}

.gh-stat-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.gh-stat-card {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-left: 4px solid #8a98ad;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 12px;
}

.gh-stat-card span {
  color: var(--gh-muted);
  font-size: 13px;
  font-weight: 700;
}

.gh-stat-card strong {
  font-size: 28px;
  line-height: 1;
}

.gh-stat-card.is-friendly {
  border-left-color: var(--gh-ok);
}

.gh-stat-card.is-hostile {
  border-left-color: var(--gh-danger);
}

.gh-stat-card.is-neutral {
  border-left-color: #61758f;
}

.gh-player-cell {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gh-history-badge {
  background: #fff7d6;
  border: 1px solid #f2d46b;
  border-radius: 999px;
  color: #7a4d00;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 26px;
  padding: 5px 8px;
}

.gh-history-badge:hover {
  background: #ffefad;
}

.gh-toast {
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  margin: 12px 18px 0;
  padding: 10px 12px;
}

.gh-toast-ok {
  background: var(--gh-ok);
}

.gh-toast-error {
  background: var(--gh-danger);
}

.gh-ocr-grid {
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.gh-ocr-upload {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.gh-upload-button {
  background: #eef2f7;
  border: 1px solid #c8cfda;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 12px;
}

.gh-upload-button input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.gh-ocr-status {
  color: var(--gh-muted);
  font-size: 13px;
}

.gh-ocr-preview {
  border: 1px solid var(--gh-line);
  border-radius: 8px;
  display: block;
  margin: 0 0 12px;
  max-height: 320px;
  max-width: 100%;
  object-fit: contain;
}

.gh-ocr-text {
  display: block;
  margin-bottom: 12px;
}

.is-ok {
  color: var(--gh-ok);
  font-weight: 700;
}

.is-error {
  color: var(--gh-danger);
  font-weight: 700;
}

.gh-save-status {
  color: var(--gh-muted);
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  min-height: 16px;
}

.gh-comments-panel,
.gh-history-panel {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 14px;
}

.gh-comment-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.gh-comment-form textarea {
  min-height: 88px;
}

.gh-comments-list {
  display: grid;
  gap: 10px;
}

.gh-comment {
  background: #f8fafc;
  border: 1px solid var(--gh-line);
  border-radius: 8px;
  padding: 10px;
}

.gh-comment-meta {
  align-items: center;
  color: var(--gh-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gh-comment-body {
  margin-bottom: 10px;
  white-space: normal;
}

.gh-history-list {
  display: grid;
  gap: 10px;
}

.gh-history-item {
  background: #f8fafc;
  border: 1px solid var(--gh-line);
  border-radius: 8px;
  padding: 10px;
}

.gh-history-main,
.gh-history-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gh-history-main {
  margin-bottom: 8px;
}

.gh-history-main span,
.gh-history-meta {
  color: var(--gh-muted);
  font-size: 13px;
}

.gh-history-comments {
  border-top: 1px solid var(--gh-line);
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
}

.gh-history-comments p {
  margin: 0;
}

.gh-login-required {
  padding: 18px;
}

@media (max-width: 840px) {
  .gh-topbar,
  .gh-layout,
  .gh-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .gh-list {
    flex-basis: auto;
  }

  .gh-actions {
    flex-wrap: wrap;
  }
}
