:root {
  --field-ink: #20251f;
  --field-paper: #e8dfbf;
  --field-paper-dark: #c6b98f;
  --field-olive: #44533c;
  --field-olive-dark: #252f25;
  --field-brass: #d4a642;
  --field-red: #b23a34;
  --field-blue: #2f6687;
}

.artillery-page {
  color: var(--field-ink);
  background:
    repeating-linear-gradient(0deg, rgba(48, 58, 43, 0.06) 0 1px, transparent 1px 28px),
    linear-gradient(180deg, #d9cfac, #b8aa7d);
}

.artillery-page .site-header {
  color: #f0e8ca;
  background: rgba(34, 43, 34, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.artillery-page .site-brand-mark {
  color: #20251f;
  background: var(--field-brass);
  box-shadow: 4px 4px 0 #182019;
}

.artillery-page .site-brand-text span {
  color: rgba(240, 232, 202, 0.68);
}

.artillery-page .site-footer {
  color: rgba(240, 232, 202, 0.7);
  background: #252f25;
  border-top: 0;
}

.artillery-page .site-footer strong,
.artillery-page .site-footer a:hover {
  color: var(--field-brass);
}

.artillery-main {
  min-height: calc(100svh - var(--site-header-h));
}

.artillery-stage {
  width: min(1220px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 0;
}

.battlefield-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 650;
  overflow: hidden;
  background: #78949b;
  border: 7px solid #2b342b;
  border-radius: 4px;
  box-shadow:
    0 0 0 3px #9d8e62,
    0 0 0 8px #4c5744,
    0 22px 50px rgba(42, 37, 24, 0.32);
}

#artillery-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.battle-hud {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 12px;
  pointer-events: none;
}

.tank-status {
  width: min(310px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 42px;
  gap: 9px;
  align-items: center;
  padding: 7px 10px;
  color: #f6eed3;
  background: rgba(32, 39, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 4px 4px 0 rgba(21, 27, 22, 0.34);
}

.tank-two-status {
  justify-self: end;
}

.tank-status.is-active {
  outline: 3px solid var(--field-brass);
  outline-offset: 2px;
}

.tank-status.is-defeated {
  filter: grayscale(1);
  opacity: 0.62;
}

.tank-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #20251f;
  background: var(--field-brass);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 900;
}

.tank-status > div {
  min-width: 0;
}

.tank-status b {
  display: block;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tank-status > strong {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  text-align: center;
}

.health-track {
  height: 6px;
  display: block;
  margin-top: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.health-track i {
  width: 100%;
  height: 100%;
  display: block;
  background: #83b35b;
  transform-origin: left;
  transition: transform 0.4s ease, background 0.3s ease;
}

.turn-instrument {
  min-width: 160px;
  align-self: start;
  padding: 7px 13px;
  color: #272d25;
  background: rgba(232, 223, 191, 0.92);
  border: 2px solid #4b5546;
  box-shadow: 3px 3px 0 rgba(35, 42, 34, 0.3);
  text-align: center;
}

.turn-instrument > span {
  display: block;
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wind-gauge {
  display: grid;
  grid-template-columns: auto auto minmax(56px, 1fr) auto auto;
  gap: 5px;
  align-items: center;
  margin-top: 3px;
}

.wind-gauge .wind-name {
  color: #5d6552;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wind-gauge .wind-side {
  color: rgba(39, 45, 37, 0.38);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.wind-gauge .wind-side.is-blowing {
  color: #8a332e;
}

.wind-gauge .wind-track {
  position: relative;
  height: 7px;
  background: rgba(59, 68, 55, 0.3);
  border: 1px solid rgba(75, 85, 70, 0.55);
  overflow: hidden;
}

.wind-gauge .wind-track b {
  position: absolute;
  left: 50%;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: rgba(42, 51, 39, 0.8);
  transform: translateX(-50%);
}

.wind-gauge #wind-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  background: repeating-linear-gradient(90deg, #d4a642 0 5px, #c08f2c 5px 8px);
  transition: width 0.45s ease, transform 0.45s ease;
}

.wind-gauge #wind-fill.is-left {
  transform: translateX(-100%);
}

.wind-gauge .wind-value {
  min-width: 12px;
  color: #8a332e;
  font-family: Georgia, serif;
  font-size: 0.86rem;
  line-height: 1;
  text-align: right;
}

.battle-tools {
  position: absolute;
  right: 13px;
  bottom: 13px;
  z-index: 5;
  display: flex;
  gap: 7px;
}

.field-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #f3e7bc;
  background: rgba(35, 44, 35, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  box-shadow: 3px 3px 0 rgba(20, 25, 20, 0.3);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.field-icon-button:hover {
  color: #20251f;
  background: var(--field-brass);
}

.artillery-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 64px 16px 18px;
  overflow-y: auto;
  background:
    linear-gradient(rgba(33, 43, 35, 0.54), rgba(33, 43, 35, 0.22)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 8px);
  backdrop-filter: blur(2px);
}

.field-order {
  width: min(580px, 100%);
  position: relative;
  padding: clamp(20px, 3.5vw, 38px);
  color: var(--field-ink);
  background:
    linear-gradient(90deg, transparent 30px, rgba(157, 65, 55, 0.25) 30px 32px, transparent 32px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(56, 75, 73, 0.12) 27px 28px),
    var(--field-paper);
  border: 1px solid #756b4f;
  border-radius: 2px;
  box-shadow: 14px 16px 0 rgba(26, 33, 26, 0.34);
  transform: rotate(-0.45deg);
}

.field-order::after {
  content: '';
  position: absolute;
  right: 34px;
  top: 24px;
  width: 66px;
  height: 66px;
  border: 3px double rgba(143, 52, 45, 0.55);
  border-radius: 50%;
  pointer-events: none;
  transform: rotate(11deg);
}

.order-stripe {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 5px 12px;
  color: #eee4c5;
  background: var(--field-olive);
  font-size: 0.62rem;
  font-weight: 900;
}

.order-kicker {
  width: fit-content;
  margin: 4px auto 7px;
  padding: 2px 7px;
  color: #f3e9c9;
  background: var(--field-red);
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.field-order h1,
.field-order h2 {
  color: #283327;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.field-order h1 {
  margin: 0 0 10px;
  font-size: clamp(2.65rem, 7vw, 4.9rem);
  line-height: 0.8;
}

.field-order h2 {
  margin-bottom: 13px;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 0.95;
}

.order-lead {
  max-width: 470px;
  margin: 0 auto 18px;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.mode-switch legend {
  width: 100%;
  margin-bottom: 6px;
  color: #5d5a47;
  font-size: 0.65rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.mode-switch label {
  position: relative;
  cursor: pointer;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
}

.mode-switch span {
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 10px;
  background: rgba(255, 252, 232, 0.38);
  border: 2px solid rgba(66, 75, 58, 0.28);
  text-align: center;
}

.mode-switch input:checked + span {
  color: #f2e8c9;
  background: var(--field-olive);
  border-color: var(--field-olive-dark);
  box-shadow: 3px 3px 0 rgba(34, 41, 32, 0.22);
}

.mode-switch b {
  font-size: 0.82rem;
}

.mode-switch small {
  margin-top: 2px;
  font-size: 0.66rem;
}

.order-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 14px 0;
  border-block: 1px solid rgba(71, 76, 57, 0.28);
}

.order-notes span {
  padding: 8px 3px;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.order-notes b {
  display: block;
  color: var(--field-red);
  font-size: 1.05rem;
}

.order-button,
.order-text-button {
  position: relative;
  z-index: 2;
  font-family: var(--font);
  font-weight: 900;
  cursor: pointer;
}

.order-button {
  width: min(330px, 100%);
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 9px 16px;
  color: #f7edcf;
  background: var(--field-red);
  border: 2px solid #682720;
  border-radius: 2px;
  box-shadow: 0 6px 0 #682720;
  font-size: 1rem;
  text-transform: uppercase;
}

.order-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #682720;
}

.order-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #682720;
}

.order-button small {
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 650;
  text-transform: none;
}

.battle-record {
  margin-top: 13px;
  color: #5f604f;
  font-size: 0.72rem;
  font-weight: 750;
  text-align: center;
}

.battle-record strong {
  color: var(--field-red);
}

.result-order,
.pause-order {
  width: min(500px, 100%);
  text-align: center;
}

.result-emblem {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 13px;
  color: #2a3327;
  background: var(--field-brass);
  border: 5px double #596046;
  border-radius: 50%;
  font-size: 2.2rem;
}

.result-order > p:not(.order-kicker) {
  line-height: 1.45;
}

.battle-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0;
  border-block: 2px solid rgba(67, 74, 54, 0.35);
}

.battle-summary div {
  padding: 10px 5px;
}

.battle-summary div + div {
  border-left: 1px solid rgba(67, 74, 54, 0.25);
}

.battle-summary dt {
  color: #696956;
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
}

.battle-summary dd {
  color: var(--field-red);
  font-family: Georgia, serif;
  font-size: 1.22rem;
  font-weight: 900;
}

.order-text-button {
  margin-top: 17px;
  color: var(--field-olive-dark);
  background: transparent;
  border: 0;
  font-size: 0.84rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pause-order .order-button {
  margin-top: 22px;
}

.turn-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  min-width: 210px;
  padding: 11px 24px;
  color: #f3e8c5;
  background: rgba(36, 45, 36, 0.94);
  border: 2px solid var(--field-brass);
  box-shadow: 7px 7px 0 rgba(25, 31, 25, 0.25);
  text-align: center;
  transform: translate(-50%, -50%) rotate(-1deg);
  animation: turnCard 1.1s both;
}

.turn-card span,
.turn-card strong {
  display: block;
}

.turn-card span {
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
}

.turn-card strong {
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

@keyframes turnCard {
  0% { opacity: 0; transform: translate(-50%, -42%) rotate(-1deg); }
  15%, 80% { opacity: 1; transform: translate(-50%, -50%) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -56%) rotate(-1deg); }
}

.battle-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 8;
  max-width: calc(100% - 130px);
  padding: 8px 15px;
  color: #f4e9ca;
  background: rgba(36, 44, 35, 0.94);
  border-left: 5px solid var(--field-brass);
  box-shadow: 4px 4px 0 rgba(28, 33, 27, 0.25);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

.fire-control {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(190px, 0.75fr) 120px;
  gap: 1px;
  align-items: stretch;
  margin: 12px 0 0;
  color: #eee4c5;
  background: #141a15;
  border: 5px solid #303b31;
  box-shadow: 0 10px 28px rgba(45, 39, 26, 0.25);
}

.control-gauge,
.munition-select {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 11px 15px;
  background:
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(255, 255, 255, 0.02) 19px 20px),
    var(--field-olive-dark);
}

.control-gauge > span,
.munition-select > span {
  color: #aeb39b;
  font-size: 0.63rem;
  font-weight: 900;
  text-transform: uppercase;
}

.control-gauge output {
  color: var(--field-brass);
  font-family: Georgia, serif;
  font-size: 1.12rem;
  font-weight: 900;
}

.control-gauge input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--field-brass);
  cursor: pointer;
}

.munition-select {
  grid-template-columns: 1fr;
}

.munition-select select {
  width: 100%;
  min-width: 0;
  color: #f0e7ca;
  background: #374238;
  border: 1px solid #69705d;
  border-radius: 2px;
  padding: 8px 7px;
  font: 750 0.78rem var(--font);
  cursor: pointer;
}

.fire-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #f9edc8;
  background: #a6332e;
  border: 0;
  border-left: 4px solid #141a15;
  font: 900 1rem var(--font);
  cursor: pointer;
}

.fire-button:hover:not(:disabled) {
  background: #c0443d;
}

.fire-button:active:not(:disabled) {
  padding-top: 5px;
  background: #882823;
}

.fire-button:disabled {
  color: rgba(255, 255, 255, 0.34);
  background: #4b4d42;
  cursor: not-allowed;
}

.fire-sight {
  font-size: 1.45rem;
  line-height: 1;
}

.artillery-info {
  width: min(1060px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px 46px;
  margin: 0 auto;
  padding: clamp(46px, 7vw, 78px) 0;
}

.artillery-info h2 {
  margin-bottom: 14px;
  color: #283327;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 0.98;
}

.artillery-info > div > p:last-child {
  color: #47483c;
  font-size: 1.03rem;
  line-height: 1.7;
}

.artillery-game-facts {
  display: grid;
  align-self: end;
  gap: 11px;
}

.artillery-game-facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(67, 74, 54, 0.28);
}

.artillery-game-facts dt {
  color: #666655;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.artillery-game-facts dd {
  font-weight: 900;
  text-align: right;
}

.artillery-info ul {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 30px;
  padding: 22px 0 0;
  border-top: 3px solid #4c5845;
  list-style: none;
}

.artillery-info li {
  position: relative;
  padding-left: 23px;
  line-height: 1.45;
}

.artillery-info li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--field-red);
  font-size: 0.78rem;
}

body.artillery-playing {
  overflow: hidden;
}

.artillery-playing .artillery-stage {
  height: calc(100dvh - var(--site-header-h));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding-bottom: 10px;
}

/* V celoobrazovkovém režimu necháváme výšku rámu odvodit z šířky přes
   aspect-ratio (1200/650) – rám tak nikdy nezlomí poměr stran, když by
   max-width clampnul výškově odvozenou šířku. max-height je pojistka
   pro velmi široká a nízká okna (tam dorovná uniformní render). */
.artillery-playing .battlefield-frame {
  width: 100%;
  height: auto;
  max-height: 100%;
  justify-self: center;
  align-self: center;
}

.artillery-playing .artillery-info {
  display: none;
}

@media (max-width: 760px) {
  .artillery-stage {
    width: min(100% - 12px, 1220px);
    padding-top: 10px;
  }

  .artillery-page:not(.artillery-playing) .battlefield-frame {
    height: 570px;
    aspect-ratio: auto;
  }

  .artillery-page:not(.artillery-playing) #artillery-canvas {
    width: auto;
    min-width: 100%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .battlefield-frame {
    border-width: 4px;
    box-shadow: 0 0 0 2px #9d8e62, 0 0 0 5px #4c5744;
  }

  .battle-hud {
    inset: 6px 6px auto;
    grid-template-columns: 1fr 114px 1fr;
    gap: 4px;
  }

  .turn-instrument {
    max-width: 114px;
  }

  .turn-instrument > span {
    font-size: 0.44rem;
  }

  .tank-status {
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 4px;
    padding: 4px 5px;
  }

  .tank-status > strong {
    display: none;
  }

  .tank-two-status {
    grid-template-columns: minmax(0, 1fr) 25px;
  }

  .tank-badge {
    width: 23px;
    height: 23px;
    font-size: 0.52rem;
  }

  .tank-status b {
    font-size: 0.58rem;
  }

  .health-track {
    height: 4px;
    margin-top: 2px;
  }

  .turn-instrument {
    min-width: 0;
    padding: 4px 3px;
  }

  .turn-instrument span,
  .turn-instrument strong {
    font-size: 0.48rem;
  }

  .wind-gauge {
    grid-template-columns: auto auto minmax(34px, 1fr) auto auto;
    gap: 3px;
  }

  .wind-gauge .wind-name {
    font-size: 0.44rem;
  }

  .wind-gauge .wind-side {
    font-size: 0.5rem;
  }

  .wind-gauge .wind-value {
    font-size: 0.62rem;
  }

  .battle-tools {
    right: 7px;
    bottom: 7px;
  }

  .field-icon-button {
    width: 31px;
    height: 31px;
  }

  .artillery-overlay {
    align-items: start;
    padding: 42px 7px 8px;
  }

  .field-order {
    padding: 18px 16px 20px;
    box-shadow: 8px 9px 0 rgba(26, 33, 26, 0.3);
  }

  .field-order::after {
    right: 15px;
    top: 17px;
    width: 48px;
    height: 48px;
  }

  .field-order h1 {
    font-size: clamp(2.25rem, 13vw, 3.4rem);
  }

  .order-lead {
    margin-bottom: 10px;
    font-size: 0.78rem;
  }

  .mode-switch {
    margin-bottom: 8px;
  }

  .mode-switch span {
    min-height: 46px;
    padding: 5px;
  }

  .mode-switch b {
    font-size: 0.7rem;
  }

  .mode-switch small {
    font-size: 0.55rem;
  }

  .order-notes {
    margin: 7px 0 9px;
  }

  .order-notes span {
    padding: 5px 2px;
    font-size: 0.56rem;
  }

  .order-notes b {
    font-size: 0.9rem;
  }

  .order-button {
    min-height: 46px;
  }

  .battle-record {
    margin-top: 8px;
  }

  .fire-control {
    grid-template-columns: 1fr 1fr 78px;
    margin-top: 8px;
    border-width: 3px;
  }

  .control-gauge,
  .munition-select {
    padding: 6px 8px;
  }

  .control-gauge > span,
  .munition-select > span {
    font-size: 0.5rem;
  }

  .control-gauge output {
    font-size: 0.8rem;
  }

  .munition-select {
    grid-column: 1 / 3;
    grid-template-columns: auto 1fr;
  }

  .munition-select select {
    padding: 5px;
    font-size: 0.64rem;
  }

  .fire-button {
    grid-column: 3;
    grid-row: 1 / 3;
    border-left-width: 3px;
    font-size: 0.78rem;
  }

  .artillery-info {
    grid-template-columns: 1fr;
    padding: 40px 0;
  }

  .artillery-info ul {
    grid-template-columns: 1fr;
  }

  .artillery-playing {
    --site-header-h: 64px;
    overflow-y: auto;
  }

  .artillery-playing .artillery-stage {
    height: auto;
    display: block;
  }

  .artillery-playing .battlefield-frame {
    width: 100%;
    height: auto;
  }

  .artillery-playing .site-header {
    min-height: var(--site-header-h);
    align-items: center;
    flex-wrap: nowrap;
    padding-block: 8px;
  }

  .artillery-playing .site-brand {
    width: auto;
  }

  .artillery-playing .site-brand-text span,
  .artillery-playing .site-nav {
    display: none;
  }

  .artillery-playing .site-back-link {
    margin-left: auto;
  }
}

@media (max-height: 720px) {
  .field-order {
    padding-block: 15px 17px;
  }

  .field-order h1 {
    font-size: 2.55rem;
    margin-bottom: 6px;
  }

  .order-lead {
    margin-bottom: 8px;
  }

  .order-notes {
    margin-block: 6px;
  }

  .order-button {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .turn-card {
    animation: none;
  }
}
