@font-face {
  font-family: "Press Start";
  src: url("https://fonts.gstatic.com/s/pressstart2p/v14/e3t4euO8T-267oIAQAu6jDQyK6D1.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1b1b1b;
  --accent: #e3572a;
  --accent-2: #1f7a8c;
  --bg: #f3e7d3;
  --panel: #fbf3e4;
  --shadow: rgba(27, 27, 27, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fff4e0 0%, #f3e7d3 40%, #e9dac3 100%);
  color: var(--ink);
  font-family: "Press Start", "Courier New", monospace;
  overflow-x: hidden;
}

.app-page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  width: 100%;
  overflow: hidden;
}

.app-game-title {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.app-subtitle {
  font-size: 10px;
}

.app-game-shell {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--panel);
  box-shadow: none;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
}

.app-turn {
  font-size: 14px;
}

.app-stats {
  font-size: 12px;
  display: flex;
  gap: 16px;
}


.app-btn {
  font-family: inherit;
  font-size: 12px;
  padding: 8px 16px;
  border: 3px solid var(--ink);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow);
  height: auto;
}

.app-btn.app-secondary {
  background: var(--accent-2);
}

.app-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.app-screen {
  position: relative;
  background: #93d7f2;
  overflow: hidden;
  width: 100%;
  min-height: 0;
  height: 100%;
}

.app-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  pointer-events: none;
}

.app-overlay-left {
  display: grid;
  gap: 6px;
}

.app-overlay-right {
  display: flex;
  gap: 8px;
  pointer-events: auto;
  align-items: flex-start;
}

.app-overlay-right > * {
  align-self: flex-start;
}

.app-share {
  position: relative;
  pointer-events: auto;
}

.app-share-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  padding: 10px;
  border: 3px solid var(--ink);
  background: rgba(251, 243, 228, 0.96);
  box-shadow: 4px 4px 0 var(--shadow);
  display: none;
  gap: 8px;
  flex-direction: column;
  z-index: 5;
}

.app-share-panel.app-share-open {
  display: flex;
}

.app-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.app-share-close {
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0 6px;
}

.app-share-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 2px 2px 0 var(--shadow);
  line-height: 1;
}

.app-share-link:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.app-share-icon {
  width: 16px;
  height: 16px;
}

.app-share-panel svg {
  width: 16px;
  height: 16px;
  display: block;
}

.app-link {
  font-family: inherit;
  font-size: 12px;
  padding: 8px 16px;
  color: #fff;
  text-decoration: none;
  border: 3px solid var(--ink);
  background: var(--accent);
  box-shadow: 4px 4px 0 var(--shadow);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.app-link:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  image-rendering: pixelated;
}


@media (max-width: 700px) {
  .app-overlay {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .app-overlay-right {
    width: 100%;
    justify-content: flex-start;
  }
}
