@font-face {
  font-family: 'GoudyMediaeval';
  src: url('font/goudy-medieval/Goudy Mediaeval Regular.ttf') format('truetype');
  font-weight: normal;
}

@font-face {
  font-family: 'GoudyMediaeval';
  src: url('font/goudy-medieval/Goudy Mediaeval DemiBold.ttf') format('truetype');
  font-weight: bold;
}

:root {
  --allied-line-color: #c8b88a;
  --enemy-line-color: #c8b88a;
  --bg-brown-light: #8D6137;
  --bg-brown-mid: #7D572D;
  --bg-brown-dark: #272817;
  --card-back-turquoise: #6C9FB0;
  --card-back-oval: #707090;
  --card-back-oval-brighter: #7070F3;
  --symbol-outline-color: #272817;
  --menu-action-color: #ccc;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  font-family: 'Jost', system-ui, sans-serif;
  color: #e0e0e0;
  background-color: var(--bg-brown-dark);
  min-height: 100vh;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(
        ellipse at center,
        var(--bg-brown-light) 0%,
        var(--bg-brown-mid) 40%,
        var(--bg-brown-dark) 100%
      );
}

#gas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90%;
  padding: 1rem;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Menu button — top-right on every page */
.menu-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 200ms ease, background 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.menu-btn:hover {
  color: #c8b88a;
  background: rgba(200, 184, 138, 0.1);
}

.menu-btn:active {
  transform: scale(0.92);
}

/* Settings backdrop */
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
  backdrop-filter: blur(2px);
}

/* Settings panel */
.settings-panel {
  position: fixed;
  top: 3.5rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 11;
  background: color-mix(in srgb, var(--bg-brown-dark) 97%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid #333;
  border-radius: 16px;
  padding: 1.5rem;
  min-width: 260px;
  max-width: calc(100vw - 2rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.settings-panel[hidden] {
  display: none;
}

.settings-backdrop[hidden] {
  display: none;
}

.settings-title {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'GoudyMediaeval', Georgia, serif;
  color: #f0f0f0;
  margin: 0;
  padding-left: calc(0.75rem + 1px);
}

.settings-title-link {
  color: inherit;
  text-decoration: none;
}

.settings-close-btn {
  position: absolute;
  top: calc(1.5rem - 0.2rem);
  right: calc(1.5rem - 0.4rem);
  background: transparent;
  border: none;
  color: var(--menu-action-color);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 200ms ease;
}

.settings-close-btn:hover {
  color: #ccc;
}

.settings-version {
  font-size: 0.9rem;
  color: #666;
  margin-top: -1.5rem;
  padding-left: calc(0.75rem + 1px);
}

.settings-trace-container {
  font-size: 0.95rem;
  padding-left: calc(0.75rem + 1px);
}

.settings-trace-container[hidden] {
  display: none;
}

.settings-trace-link {
  font-size: 0.95rem;
}

.settings-about-link {
  display: inline-block;
  font-size: 1.05rem;
  color: var(--menu-action-color);
  text-decoration: none;
  transition: color 200ms ease;
  padding-left: calc(0.75rem + 1px);
}

.settings-about-link:hover {
  color: #f0f0f0;
}

.settings-share-btn {
  font-size: 1.05rem;
  color: var(--menu-action-color);
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
  align-self: stretch;
  text-align: left;
}

.settings-share-btn:hover {
  color: #ccc;
  border-color: #666;
  background: rgba(200, 184, 138, 0.08);
}

.settings-reset-btn {
  font-size: 1.05rem;
  color: #c07070;
  background: transparent;
  border: 1px solid #7a3a3a;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
  -webkit-tap-highlight-color: transparent;
  align-self: stretch;
  text-align: left;
}

.settings-reset-btn:hover {
  background: rgba(200, 80, 80, 0.15);
  border-color: #a05050;
  color: #e08080;
}

.trace-link {
  color: #666;
  text-decoration: none;
  border-bottom: 1px dotted #555;
  transition: color 200ms ease, border-color 200ms ease;
}

.trace-link:hover {
  color: #999;
  border-bottom-color: #888;
}

/* Mana gas control buttons */
.gas-btn {
  position: fixed;
  bottom: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.3s, background 0.3s;
  backdrop-filter: blur(4px);
}
.gas-btn:hover { background: rgba(255,255,255,0.2); }
.gas-btn:active { transform: scale(0.9); }
#gas-fan-btn { right: 30px; }
#gas-stop-btn { right: 110px; }
#gas-stop-btn.stopped { border-color: rgba(255,100,100,0.6); background: rgba(255,100,100,0.15); }
#gas-fan-btn.spinning svg { animation: gas-spin 0.4s linear; }
@keyframes gas-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
