:root {
  --green: #3f965f;
  --green-dark: #2f7e4f;
  --blue: #2f6fd6;
  --blue-dark: #1f4fa3;
  --red: #c8423a;
  --gold: #e3b23c;
  --text: #26372c;
  --muted: #5f7066;
  --panel: #ffffff;
  --border: rgba(138, 147, 140, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f1f6f2;
  color: var(--text);
  font-family: "Gill Sans", "Avenir Next", "Trebuchet MS", sans-serif;
}

button {
  font: inherit;
}

.tr-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.tr-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.tr-top h1 {
  margin: 0;
  color: var(--blue-dark);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.tr-back {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.tr-hud {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tr-stat {
  display: grid;
  gap: 2px;
}

.tr-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tr-coins {
  color: #a57510;
  font-size: 1.6rem;
}

.tr-coins::before {
  content: "●";
  margin-right: 6px;
  color: var(--gold);
}

.tr-hearts {
  color: #d23b4b;
  font-size: 1.4rem;
  letter-spacing: 2px;
}

.tr-hearts .tr-heart-empty {
  color: #d9d2cf;
}

.tr-shield-status {
  color: var(--blue-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.tr-button-shield {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue-dark);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tr-button-shield.is-raised {
  background: var(--blue-dark);
}

.tr-progress {
  height: 12px;
  border-radius: 6px;
  background: #e7ece8;
  overflow: hidden;
}

.tr-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #5b97f0);
  transition: width 0.3s ease;
}

.tr-progress-text {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.tr-actions {
  display: flex;
  gap: 8px;
}

.tr-button {
  min-height: 40px;
  padding: 6px 14px;
  color: var(--green-dark);
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.tr-button:hover:not(:disabled),
.tr-button:focus-visible {
  border-color: var(--green);
  outline: none;
}

.tr-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.tr-button-shop {
  color: #fff;
  background: var(--gold);
  border-color: #c99520;
}

.tr-button-big {
  min-height: 52px;
  padding: 10px 26px;
  color: #fff;
  font-size: 1.2rem;
  background: var(--blue);
  border-color: var(--blue-dark);
}

.tr-stage {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 14px 42px rgba(35, 52, 42, 0.14);
  background: #a9d8f2;
}

.tr-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 640;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tr-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 34, 50, 0.35);
}

.tr-overlay[hidden] {
  display: none;
}

.tr-card {
  width: min(100%, 460px);
  padding: 22px 24px;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.tr-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tr-card h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.tr-overlay-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.tr-overlay-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tr-shop {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  background: rgba(255, 253, 246, 0.97);
}

.tr-shop[hidden] {
  display: none;
}

.tr-shop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tr-shop-header h2 {
  margin: 0;
  color: #a57510;
}

.tr-shop-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.tr-shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.tr-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tr-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tr-item-head strong {
  font-size: 1.05rem;
}

.tr-item-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.tr-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.tr-item .tr-button {
  width: 100%;
}

.tr-shop-feedback {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--green-dark);
  font-weight: 700;
}

.tr-help {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.tr-reset {
  margin-top: 10px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.85rem;
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 720px) {
  .tr-hud {
    grid-template-columns: auto auto;
    gap: 10px 18px;
  }

  .tr-progress-block,
  .tr-actions {
    grid-column: 1 / -1;
  }

  .tr-actions .tr-button {
    flex: 1;
  }

  .tr-overlay {
    position: fixed;
    z-index: 9;
  }

  .tr-shop {
    position: fixed;
    z-index: 10;
    padding: 12px;
  }
}
