:root {
  --canvas: #f8f7f5;
  --surface: #ffffff;
  --surface-soft: #fbfaf8;
  --text: #181719;
  --muted: #67636a;
  --border: #dfdcda;
  --border-strong: #cfc9c6;
  --accent: #7f1838;
  --accent-dark: #64122b;
  --accent-soft: #f7edf1;
  --danger: #a43442;
  --warning: #8b6418;
  --shadow: 0 8px 28px rgb(26 20 22 / 5%);
  --radius: 14px;
  --max-width: 1440px;
  color-scheme: light;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

a {
  color: inherit;
}

code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgb(248 247 245 / 94%);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(calc(100% - 40px), var(--max-width));
  min-height: 98px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
}

.brand strong {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  letter-spacing: -0.025em;
}

.brand span {
  color: var(--muted);
  font-size: 0.94rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 52px);
}

.site-nav a {
  position: relative;
  padding: 36px 0 31px;
  text-decoration: none;
  font-weight: 520;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 17px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  color: var(--accent);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-nav a.active::after {
  transform: scaleX(1);
}

button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgb(127 24 56 / 20%);
  outline-offset: 3px;
}

.page-shell {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 28px;
  padding: 30px 0 52px;
}

.sidebar,
.game-column {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.info-panel,
.control-panel,
.source-panel {
  padding: 22px;
}

.panel h2 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-meta {
  display: grid;
  gap: 15px;
  margin: 22px 0 0;
}

.project-meta div {
  display: grid;
  gap: 3px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.project-meta dt {
  color: var(--accent-dark);
  font-size: 0.79rem;
  font-weight: 760;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.project-meta dd {
  margin: 0;
  color: var(--muted);
}

.control-actions {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.control-actions button,
.outline-link {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 620;
}

.control-actions button:hover:not(:disabled),
.outline-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.control-note,
.source-panel p,
.player-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.91rem;
}

.outline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 0 17px;
  color: var(--accent);
  text-decoration: none;
}

.game-panel {
  padding: clamp(18px, 3vw, 30px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.game-panel h2,
.content-section h2 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 650;
}

.unity-shell {
  position: relative;
  width: 100%;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #15171b;
  aspect-ratio: 8 / 5;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #15171b;
}

.unity-loading,
.game-error {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 60px);
  background: #181b20;
  color: #fff;
}

.loading-copy {
  width: min(100%, 520px);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.loading-copy span {
  color: #d7d9dc;
}

.progress-track {
  width: min(100%, 520px);
  height: 9px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #4d5056;
  border-radius: 999px;
  background: #292c32;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 120ms linear;
}

.unity-warning {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 50%;
  width: min(calc(100% - 24px), 720px);
  transform: translateX(-50%);
}

.warning-message {
  margin-bottom: 7px;
  padding: 10px 13px;
  border-radius: 7px;
  background: #f4d898;
  color: #4c3612;
  box-shadow: 0 6px 18px rgb(0 0 0 / 16%);
}

.warning-message.error {
  background: #f1b7be;
  color: #5e111a;
}

.game-error {
  text-align: center;
}

.game-error p {
  max-width: 560px;
  margin: 8px 0 0;
  color: #d1d4d8;
}

.content-section {
  padding: clamp(48px, 8vw, 86px) 0;
  border-top: 1px solid var(--border);
}

.content-section > h2,
.repository-section h2 {
  max-width: 840px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(26px, 6vw, 72px);
  max-width: 1050px;
  margin-top: 24px;
}

.content-grid p,
.repository-section p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.repository-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.repository-section > div {
  max-width: 800px;
}

.repository-section p:last-child {
  margin-top: 18px;
}

.repository-link {
  flex: 0 0 auto;
  margin-top: 0;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 38px 20px;
  background: #202329;
  color: #fff;
  text-align: center;
}

.site-footer span {
  color: #c4c7cb;
  font-size: 0.91rem;
}

@media (max-width: 1000px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .source-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .header-inner {
    width: min(calc(100% - 28px), var(--max-width));
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 0 0;
  }

  .site-nav {
    width: 100%;
    gap: 25px;
    overflow-x: auto;
  }

  .site-nav a {
    flex: 0 0 auto;
    padding: 14px 0 18px;
  }

  .site-nav a::after {
    bottom: 8px;
  }

  .page-shell {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .game-layout {
    padding-top: 20px;
  }

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

  .source-panel {
    grid-column: auto;
  }

  .panel-heading {
    flex-direction: column;
  }

  .status-pill {
    align-self: flex-start;
  }

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

  .repository-section {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .info-panel,
  .control-panel,
  .source-panel,
  .game-panel {
    padding: 17px;
  }

  .unity-shell {
    min-height: 380px;
    aspect-ratio: auto;
  }

  #unity-canvas {
    min-height: 380px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
