@import url("https://fonts.googleapis.com/css2?family=Jua&display=swap");
:root {
  font-family: "Jua", sans-serif;
  color: #542d1c;
  font-size: 16px;
  color-scheme: light;
  --wood: #f5c879;
  --edge: #653419;
  --shadow: #352b28;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #102d46;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
  filter: saturate(0.3);
  opacity: 0.5;
}
button:focus-visible,
input:focus-visible {
  outline: 3px solid #fff6c8;
  outline-offset: 5px;
}
#game,
#world,
#ui,
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#world {
  image-rendering: pixelated;
  outline: none;
}
#ui {
  pointer-events: none;
}
#ui button,
#ui input,
.panel,
.screen {
  pointer-events: auto;
}
.hidden {
  display: none !important;
}
.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.title-screen {
  background: linear-gradient(#17699a 0%, #73bdce 57%, #cce1a4 100%);
  isolation: isolate;
}
.title-screen:before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--title-image, none) center/cover no-repeat;
  image-rendering: pixelated;
  z-index: -1;
}
.title {
  text-align: center;
  margin-top: -8vh;
  filter: drop-shadow(0 5px 0 #513321);
}
.overline {
  letter-spacing: 0.45em;
  color: #fff5ba;
  text-shadow: 2px 2px #584726;
  font-size: 18px;
}
.title h1 {
  font-family: Georgia, serif;
  margin: 12px 0;
  font-size: clamp(54px, 8.8vw, 118px);
  font-weight: 900;
  line-height: 0.83;
  letter-spacing: 0.025em;
  color: #fbd27d;
  -webkit-text-stroke: 2px #713e20;
  text-shadow:
    3px 3px #aa662b,
    6px 6px #54321f;
}
.title h1 span {
  font-size: 0.84em;
  letter-spacing: 0.08em;
}
.subtitle {
  color: #fff4c9;
  font-size: 21px;
  text-shadow: 2px 2px #56381f;
  margin-top: 30px;
}
.title-actions {
  display: flex;
  gap: 24px;
  margin-top: clamp(55px, 15vh, 145px);
}
.wood,
.panel {
  background: #f8d791;
  border: 4px solid #6c381f;
  box-shadow:
    inset 0 0 0 3px #e6a554,
    inset 0 0 0 6px #ffe8af,
    0 5px 0 #38291e;
  border-radius: 4px;
}
.wood {
  padding: 15px 30px;
  font-size: 23px;
  min-width: 155px;
  transition:
    filter 0.1s,
    transform 0.1s;
}
.wood:hover:enabled {
  filter: brightness(1.12);
  transform: translateY(-2px);
}
.wood:active:enabled {
  transform: translateY(2px);
}
.credit {
  position: absolute;
  bottom: 18px;
  font-size: 13px;
  color: #fff6d2;
  text-shadow: 1px 1px #193c39;
}
.panel {
  padding: 28px;
}
.loading {
  text-align: center;
  min-width: 300px;
}
.loading progress {
  width: 100%;
  accent-color: #77a441;
}
#setup-screen {
  background: #163651bf;
  backdrop-filter: blur(3px);
}
.setup {
  width: min(880px, 94vw);
  max-height: 94dvh;
  overflow: auto;
}
.setup h2 {
  font-size: 28px;
  margin: 0 0 22px;
  text-align: center;
}
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}
.fields {
  display: grid;
  gap: 14px;
}
.fields label {
  display: grid;
  gap: 6px;
}
input {
  width: 100%;
  background: #fff0bf;
  border: 2px solid #ac6938;
  border-radius: 2px;
  padding: 10px 12px;
  color: #542d1c;
}
.avatar-preview {
  height: 112px;
  background: #dcb873;
  border: 2px solid #c48b47;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.avatar-preview canvas {
  width: 64px;
  height: 96px;
  image-rendering: pixelated;
}
.small {
  font-size: 15px;
  min-width: 0;
  padding: 7px 12px;
}
.farm-options {
  display: grid;
  gap: 9px;
}
.farm-option {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 15px;
  padding: 10px;
  background: #efc780;
  border: 2px solid #b5753b;
  border-radius: 2px;
}
.farm-option.active {
  background: #fff0b5;
  border-color: #743d25;
  box-shadow: inset 0 0 0 2px #d79544;
}
.farm-option img {
  width: 80px;
  height: 65px;
  object-fit: cover;
  image-rendering: pixelated;
}
.farm-option strong {
  display: block;
  font-size: 20px;
}
.farm-option small {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 5px;
}
.setup-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 23px;
}
#hud {
  position: absolute;
  top: 8px;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
.clock {
  width: 300px;
  height: 236px;
}
.clock canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.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;
}
.hud-buttons {
  display: flex;
  gap: 4px;
  margin-right: 12px;
}
.hud-link {
  pointer-events: auto;
  font: inherit;
  font-size: 16px;
  color: #ffe5b4;
  background: #32271de8;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  min-height: 44px;
  cursor: pointer;
}
.hud-link:hover,
.hud-link:focus-visible {
  background: #59412d;
  outline: 2px solid #b78b51;
}
.energy {
  position: fixed;
  bottom: 16px;
  right: 8px;
  width: 48px;
  height: 268px;
  pointer-events: auto;
}
.energy canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.energy-label {
  position: absolute;
  right: 64px;
  top: 108px;
  white-space: nowrap;
  color: white;
  text-shadow: 1px 1px #000;
  opacity: 0;
  pointer-events: none;
}
.energy:hover .energy-label,
.energy:focus .energy-label {
  opacity: 1;
}
#toolbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(800px, calc(100vw - 16px));
  aspect-ratio: 800 / 104;
}
#toolbar.menu-hidden {
  visibility: hidden;
}
#toolbar-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.toolbar-slots {
  position: absolute;
  left: 2%;
  top: 15.3846%;
  width: 96%;
  height: 61.5385%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}
.slot {
  padding: 0;
  border: 0;
  background: transparent;
  min-width: 0;
}
.slot:focus-visible {
  outline: 2px solid #fff5c9;
  outline-offset: -4px;
}
.modal.bag-modal {
  width: min(860px, 96vw);
}
.bag-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  width: 100%;
  gap: 0;
}
.bag-slot {
  padding: 0;
  background: transparent;
  border: 0;
  min-width: 0;
  aspect-ratio: 1;
}
.bag-slot canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}
.bag-slot:disabled {
  opacity: 1;
  cursor: default;
}
.held-item {
  display: flex;
  align-items: center;
  min-height: 64px;
  gap: 12px;
}
.held-item canvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
.tool-label {
  position: absolute;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 15px;
  background: #412e24bf;
  color: #fff2c8;
  white-space: nowrap;
  border-radius: 3px;
  font-size: 16px;
}
#toast {
  position: absolute;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff0bd;
  border: 3px solid #75452a;
  box-shadow: 0 3px #382c20;
  padding: 12px 20px;
  opacity: 0;
  transition: opacity 0.15s;
  max-width: 90%;
  text-align: center;
}
#toast.visible {
  opacity: 1;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: #102534a6;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.modal {
  width: min(620px, 92vw);
  max-height: 88dvh;
  overflow: auto;
}
.modal h2 {
  margin: 0 0 20px;
  font-size: 27px;
}
.modal p {
  line-height: 1.8;
}
.modal-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.inventory {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.inventory .slot {
  width: 100%;
  height: 65px;
}
.hint {
  position: absolute;
  left: 18px;
  top: 18px;
  background: #2d3d28b8;
  color: #fff0c9;
  padding: 11px 15px;
  line-height: 1.7;
  border-radius: 3px;
  font-size: 14px;
}
.day-transition {
  background: #091a28;
  color: #ffedbd;
  gap: 16px;
  transition: opacity 0.8s;
}
.day-transition h2 {
  font-size: 38px;
}
.touch-pad {
  position: absolute;
  left: 20px;
  bottom: 115px;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 4px;
}
.touch-pad button,
.touch-action {
  background: #f4ce85bd;
  border: 2px solid #724429;
  padding: 10px;
  touch-action: none;
  user-select: none;
}
.touch-action {
  position: absolute;
  right: 70px;
  bottom: 145px;
  border-radius: 50%;
  width: 64px;
  height: 64px;
}
.touch-pad button:nth-child(1) {
  grid-column: 2;
}
.touch-pad button:nth-child(2) {
  grid-column: 1;
}
.touch-pad button:nth-child(4) {
  grid-column: 2;
}
.touch-pad button:nth-child(3) {
  grid-column: 3;
  grid-row: 2;
}
@media (max-width: 650px) {
  .title-actions {
    gap: 9px;
  }
  .wood {
    min-width: 0;
    padding: 13px 18px;
    font-size: 19px;
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
  .avatar-preview {
    height: 80px;
  }
  .farm-options {
    grid-template-columns: repeat(3, 1fr);
  }
  .farm-option {
    display: block;
    padding: 7px;
  }
  .farm-option img {
    width: 100%;
    height: 50px;
  }
  .farm-option strong {
    font-size: 16px;
  }
  .farm-option small {
    display: none;
  }
  .setup {
    padding: 20px;
  }
  .fields {
    gap: 7px;
    grid-template-columns: 1fr 1fr;
  }
  .fields .avatar-preview {
    grid-column: 1/-1;
  }
  .setup-actions {
    margin-top: 15px;
  }
  .clock {
    width: 225px;
    height: 177px;
  }
  #hud {
    top: 6px;
    right: 0;
    gap: 4px;
  }
  .energy {
    bottom: 12px;
    right: 6px;
    width: 36px;
    height: 201px;
  }
  .energy-label {
    right: 45px;
    top: 81px;
    font-size: 13px;
  }
  .hint {
    display: none;
  }
  .credit {
    font-size: 11px;
  }
  .tool-label {
    bottom: 70px;
  }
  .title h1 {
    -webkit-text-stroke: 1px #713e20;
  }
}
.title-screen {
  --title-image: url("./assets/stardewbackground.png");
}
.title {
  filter: none;
  margin-top: -12vh;
}
.game-logo {
  width: min(590px, 74vw);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 #253b4360);
}
.title .overline {
  margin-bottom: 10px;
}
.title .subtitle {
  margin: 0;
}
.title-actions {
  margin-top: 9vh;
}
.startup {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0d1928;
  color: #fbe9b9;
  z-index: 30;
  pointer-events: none;
  animation: startupFade 1.6s forwards;
}
.startup p {
  letter-spacing: 0.1em;
  font-size: 21px;
}
@keyframes startupFade {
  0%,
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
.inventory-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px;
  background: #edc780;
  border: 2px solid #bd8145;
}
.inventory-item img {
  width: 35px;
  height: 35px;
  image-rendering: pixelated;
}
.inventory-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.save-note {
  font-size: 14px;
  color: #764627;
}
.welcome-letter {
  font-size: 18px;
  line-height: 1.8;
}
.screen.day-transition {
  z-index: 20;
}
.alert-message {
  color: #91371e;
}
@media (pointer: coarse) {
  #touch-controls:not(.hidden) {
    display: block;
  }
  .touch-pad,
  .touch-action {
    pointer-events: auto;
  }
}
@media (pointer: fine) {
  #touch-controls {
    display: none !important;
  }
}
.farm-options {
  max-height: 430px;
  overflow: auto;
  padding: 3px;
}
.farm-option {
  min-height: 82px;
}
.setup-grid {
  grid-template-columns: 1fr 1.3fr;
}
@media (max-width: 650px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }
  .farm-options {
    grid-template-columns: repeat(4, 1fr);
    max-height: 205px;
  }
  .farm-option {
    min-height: 70px;
  }
  .farm-option img {
    height: 40px;
  }
  .farm-option strong {
    font-size: 14px;
  }
}
/* Character creation: the selected sprite is the in-game farmer. */
.setup {
  width: min(1110px, 96vw);
}
.setup-grid {
  grid-template-columns: 1fr 1fr 1.35fr;
}
.character-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}
.character-options label {
  display: grid;
  gap: 6px;
}
.setup select {
  font: inherit;
  color: #542d1c;
  background: #fff0bf;
  border: 2px solid #ac6938;
  padding: 9px 10px;
  border-radius: 2px;
  width: 100%;
}
.setup select:focus-visible {
  outline: 3px solid #fff6c8;
  outline-offset: 2px;
}
.character-options input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 2px solid #ac6938;
  cursor: pointer;
}
.colour-choice:last-child {
  grid-column: 1/-1;
}
.fields {
  align-content: start;
}
.avatar-preview {
  min-height: 120px;
}
.avatar-preview canvas {
  width: 80px;
  height: 120px;
}
@media (max-width: 850px) {
  .setup-grid {
    grid-template-columns: 1fr 1fr;
  }
  .farm-options {
    grid-column: 1/-1;
    grid-template-columns: repeat(4, 1fr);
    display: grid;
    max-height: 205px;
  }
  .farm-option {
    display: block;
    min-height: 80px;
  }
  .farm-option img {
    width: 100%;
    height: 45px;
  }
  .farm-option small {
    display: none;
  }
  .farm-option strong {
    font-size: 15px;
  }
  .setup .fields {
    grid-template-columns: 1fr;
  }
  .avatar-preview {
    min-height: 96px;
  }
  .avatar-preview canvas {
    width: 64px;
    height: 96px;
  }
}
@media (max-width: 500px) {
  .setup {
    padding: 18px;
  }
  .setup-grid {
    gap: 14px;
  }
  .character-options {
    gap: 8px;
  }
  .character-options label {
    font-size: 14px;
  }
  .setup input,
  .setup select {
    padding: 7px 8px;
  }
  .setup h2 {
    font-size: 23px;
    margin-bottom: 15px;
  }
}

.intro-skip {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 35;
  font-size: 14px;
}
.intro-caption {
  position: fixed;
  left: 10%;
  right: 10%;
  bottom: 12%;
  text-align: center;
  color: white;
  text-shadow: 2px 2px 3px #000;
  font-size: clamp(16px, 2vw, 24px);
  line-height: 1.6;
  white-space: pre-wrap;
  z-index: 32;
}
.intro-read {
  position: fixed;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 33;
}
#intro-dialogue {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 24px 76px;
  z-index: 34;
  pointer-events: none;
}
#intro-dialogue.hidden {
  display: none;
}
.intro-letter {
  align-self: center;
  width: min(620px, 94vw);
  max-height: 85vh;
  overflow: auto;
  line-height: 1.8;
}
.arrival-dialogue {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 20px;
  width: min(920px, 95vw);
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.65;
}
.arrival-dialogue p {
  align-self: center;
  margin: 0;
}
.arrival-dialogue button {
  grid-column: 2;
  justify-self: end;
}
.arrival-portrait {
  width: 128px;
  height: 148px;
  overflow: hidden;
  position: relative;
  text-align: center;
}
.arrival-portrait canvas {
  width: 128px;
  height: 128px;
  max-width: none;
  image-rendering: pixelated;
  position: absolute;
  left: 0;
  top: 0;
}
.arrival-portrait strong {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #e9bd79;
}
.skip-intro {
  font-size: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.skip-intro input {
  width: auto;
}
@media (max-width: 650px) {
  #intro-dialogue {
    padding: 12px 12px 70px;
  }
  .arrival-dialogue {
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 14px;
  }
  .arrival-portrait {
    width: 64px;
    height: 84px;
  }
  .arrival-portrait canvas {
    width: 64px;
    height: 64px;
  }
  .intro-caption {
    left: 5%;
    right: 5%;
    bottom: 15%;
  }
  .intro-skip {
    right: 12px;
    bottom: 12px;
  }
}

#toolbar.toolbar-top .tool-label {
  top: 96px;
  bottom: auto;
}

/* CharacterCustomization: native controls over the source-coordinate Canvas. */
#setup-screen {
  background: #75b5e7 url("./assets/stardewbackground.png") center/cover no-repeat;
  backdrop-filter: none;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  overflow: auto;
}
.creation-fit {
  position: relative;
  flex: none;
}
.creation {
  position: absolute;
  width: 828px;
  height: 792px;
  top: 0;
  left: 0;
  transform-origin: top left;
  margin-top: 0;
}
.creation canvas {
  position: absolute;
  width: 828px;
  height: 792px;
  top: -64px;
  left: 0;
  image-rendering: pixelated;
  pointer-events: none;
}
.creation > :not(canvas) {
  position: absolute;
  translate: 0 -64px;
}
.creation .creation-hit {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.creation canvas.creation-tooltip {
  z-index: 5;
}
.creation :focus-visible {
  outline: 3px solid #613713;
  outline-offset: 1px;
}
.creation .creation-text {
  margin: 0;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
  font:
    22px Jua,
    sans-serif;
  color: #502913;
}
.creation-label {
  font-size: 21px;
  line-height: 32px;
  text-align: right;
  color: #502913;
  white-space: nowrap;
}
.creation-choice {
  font-size: 21px;
  line-height: 24px;
  color: #502913;
  text-align: center;
  pointer-events: none;
}
.creation-value {
  font-size: 18px;
  line-height: 20px;
  color: #502913;
  pointer-events: none;
}
.creation .creation-slider {
  appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.creation-slider::-webkit-slider-runnable-track {
  height: 20px;
  background: transparent;
}
.creation-slider::-webkit-slider-thumb {
  appearance: none;
  width: 32px;
  height: 20px;
  background: transparent;
  border: 0;
}
.creation-slider::-moz-range-track {
  height: 20px;
  background: transparent;
}
.creation-slider::-moz-range-thumb {
  width: 32px;
  height: 20px;
  background: transparent;
  border: 0;
}
.creation-skip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 21px;
  color: #502913;
  white-space: nowrap;
  cursor: pointer;
}
.creation-skip input {
  appearance: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.creation-bottom {
  width: min(804px, 96vw);
  display: flex;
  gap: 16px;
  align-items: center;
  color: #fff8d2;
  text-shadow: 1px 2px #352718;
}
.creation-bottom p {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}
.creation-bottom button {
  flex: none;
}

.inventory-item canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.level-backdrop {
  position: fixed;
  inset: 0;
  background: #0008;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 30;
}
.level-panel {
  position: relative;
  width: min(1050px, 98vw, calc(95vh * var(--level-ratio)));
  height: auto;
}
.level-panel canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.level-ok {
  position: absolute;
  left: 93.714%;
  width: 6.095%;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}
.level-ok:focus-visible {
  outline: 3px solid #ffe67e;
}

.modal.journal-modal {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  width: min(832px, 96vw, calc(90dvh * 1.3));
  max-width: none;
  max-height: none;
  overflow: visible;
}
.journal-modal canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.journal-modal .modal-buttons {
  display: none;
}
.journal-action {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.journal-action:hover {
  background: #d9ab4320;
}
.journal-action:focus-visible {
  outline: 3px solid #644120;
  outline-offset: -5px;
}
.journal-activity {
  color: #ffd06b;
}

.modal-backdrop.tv-backdrop {
  align-items: flex-end;
  background: none;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.modal.tv-modal {
  position: relative;
  width: min(832px, 96vw);
  max-width: 832px;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 26px 32px;
  overflow: visible;
  color: #512b17;
}
.tv-dialogue-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  z-index: -1;
}
.tv-modal {
  isolation: isolate;
}
.tv-modal h2 {
  font-size: 20px;
  margin-bottom: 12px;
}
.tv-modal p {
  font-size: 19px;
  line-height: 1.65;
}
.tv-modal .modal-buttons {
  margin-top: 18px;
  gap: 8px;
}
.tv-modal .wood {
  background: #f7d994;
  box-shadow: none;
}

.object-dialogue h2 {
  display: none;
}

.buffs {
  display: flex;
  gap: 8px;
}
.buff {
  width: 64px;
  position: relative;
  text-align: center;
  pointer-events: auto;
}
.buff canvas {
  display: block;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
.buff-time {
  color: white;
  font-size: 15px;
  text-shadow:
    1px 1px 2px #000,
    -1px -1px 2px #000;
}
.buff-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 88px;
  width: 210px;
  padding: 10px;
  color: #402519;
  background: #f8dcab;
  border: 3px solid #713819;
  font-size: 16px;
  z-index: 3;
}
.buff:hover .buff-tooltip,
.buff:focus .buff-tooltip {
  display: block;
}
@media (max-width: 700px) {
  .buffs {
    position: absolute;
    right: 230px;
    top: 144px;
    gap: 4px;
  }
  .buff,
  .buff canvas {
    width: 44px;
  }
  .buff canvas {
    height: 44px;
  }
  .buff-tooltip {
    right: auto;
    left: 0;
    top: 65px;
    width: 190px;
  }
}

.health {
  position: fixed;
  bottom: 16px;
  right: 64px;
  width: 48px;
  height: 224px;
  pointer-events: auto;
}
.health canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.health-label {
  position: absolute;
  right: 64px;
  top: 64px;
  white-space: nowrap;
  color: #ff5858;
  text-shadow: 1px 1px #000;
  opacity: 0;
  pointer-events: none;
}
.health:hover .health-label,
.health:focus .health-label {
  opacity: 1;
}
.health-visible .energy-label {
  right: 120px;
}
@media (max-width: 650px) {
  .health {
    bottom: 12px;
    right: 48px;
    width: 36px;
    height: 168px;
  }
  .health-label {
    right: 48px;
    top: 48px;
    font-size: 13px;
  }
  .health-visible .energy-label {
    right: 87px;
  }
}

/* In-game content workshop; shares the farm's timber/paper palette. */
#settings-button {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 25;
  pointer-events: auto;
}
#content-admin-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: auto;
}
.content-backdrop {
  height: 100%;
  padding: 24px;
  background: #13271ddb;
  display: grid;
  place-items: center;
}
.content-panel {
  width: min(1120px, 100%);
  max-height: 100%;
  overflow: auto;
  color: #452c1c;
  background: #f9e7c3;
  border: 6px solid #714327;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 3px #dbb279,
    0 16px 60px #0008;
  padding: 24px;
  font-family: Jua, sans-serif;
  font-size: 16px;
}
.content-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.content-panel h2 {
  margin: 0;
  font-size: 30px;
}
.content-kicker {
  color: #856346;
  margin: 0 0 4px;
  font-size: 14px;
}
.content-status {
  min-height: 24px;
  margin: 12px 0;
  color: #32652c;
  white-space: pre-wrap;
}
.content-status.error {
  color: #a32920;
}
.content-scope {
  font-size: 14px;
  color: #795837;
}
.content-tabs,
.content-panel footer,
.content-pack-actions,
.content-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.content-tabs {
  border-bottom: 2px solid #d4b07a;
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.content-tabs [aria-pressed="true"] {
  background: #b4cfa1;
}
.content-panel footer {
  border-top: 2px solid #d4b07a;
  margin-top: 20px;
  padding-top: 16px;
}
.content-columns {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr);
  gap: 22px;
}
.content-list {
  max-height: 58vh;
  overflow: auto;
  padding-right: 8px;
}
.content-list article {
  border-bottom: 1px solid #d2b585;
  padding: 8px 0 14px;
}
.content-select {
  text-align: left;
  display: block;
  width: 100%;
  margin: 3px 0 8px;
  background: #f0d7a8;
  border: 1px solid #c49b64;
  border-radius: 4px;
  padding: 10px;
  color: #4c2f1d;
  cursor: pointer;
  font: inherit;
  overflow-wrap: anywhere;
}
.content-select small {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: #765a3d;
}
.content-panel label {
  display: block;
  margin: 8px 0 12px;
  font-size: 16px;
}
.content-panel input:not([type="checkbox"]),
.content-panel select,
.content-panel textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 2px solid #b48b57;
  border-radius: 4px;
  background: #fffaef;
  color: #40291b;
  padding: 9px;
  font: inherit;
  box-sizing: border-box;
}
.content-panel input[type="checkbox"] {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  accent-color: #4d713f;
}
.content-panel textarea[name="content"] {
  font:
    14px/1.5 ui-monospace,
    monospace;
}
.content-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.content-hint {
  color: #785738;
  font-size: 14px;
  line-height: 1.5;
}
.content-detail {
  min-width: 0;
  overflow-wrap: anywhere;
}
.content-detail h3 {
  font-size: 20px;
  margin: 6px 0 12px;
}
.content-art {
  max-height: 300px;
  overflow: auto;
  padding: 10px;
  background-color: #eee6d6;
  background-image: conic-gradient(#d6cbb8 25%, transparent 0 50%, #d6cbb8 0 75%, transparent 0);
  background-size: 20px 20px;
}
.content-art canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.content-file {
  cursor: pointer;
}
.content-file.wood input {
  display: none;
}
.content-empty {
  padding: 16px;
  line-height: 1.6;
}
.content-login {
  max-width: 480px;
  margin: 24px auto;
}
.content-dialogue-portrait {
  float: left;
  width: 128px;
  height: 128px;
  margin: 0 16px 12px 0;
  image-rendering: pixelated;
}
.content-panel :focus-visible {
  outline: 3px solid #3b7537;
  outline-offset: 2px;
}
.content-panel [hidden] {
  display: none;
}
@media (max-width: 700px) {
  .content-backdrop {
    padding: 8px;
  }
  .content-panel {
    padding: 14px;
    border-width: 4px;
  }
  .content-panel h2 {
    font-size: 24px;
  }
  .content-columns {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .content-list {
    max-height: 190px;
  }
  #settings-button {
    bottom: 96px;
    right: 10px;
  }
  .content-panel footer .wood {
    flex: 1 1 42%;
  }
}

.rest-status {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #30271ee8;
  color: #ffe3a5;
  border: 2px solid #c18c50;
  z-index: 20;
  border-radius: 8px;
  font-size: 16px;
  pointer-events: none;
}
.rest-status[hidden] {
  display: none;
}
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.map-toolbar input[type="number"] {
  width: 80px;
}
.map-scroll,
.map-palette {
  overflow: auto;
  max-height: 55vh;
  background: #17292c;
  border: 2px solid #885728;
  overscroll-behavior: contain;
}
.map-scroll canvas {
  display: block;
  image-rendering: pixelated;
  touch-action: none;
  width: auto;
  max-width: none;
}
.map-palette {
  max-height: 280px;
}
.map-palette canvas {
  display: block;
  image-rendering: pixelated;
  max-width: none;
  width: auto;
}
.map-inspector {
  max-height: 85vh;
  overflow: auto;
}
.map-warp {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid #956432;
}
.map-warp input {
  width: 100%;
}
.map-asset {
  padding: 12px 0;
  border-bottom: 1px solid #956432;
  overflow-wrap: anywhere;
}
.map-asset canvas {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  background: repeating-conic-gradient(#dcc9a8 0 25%, #eee1c7 0 50%) 0/16px 16px;
}
.map-inspector h3 {
  margin-top: 20px;
}
.map-stage {
  min-width: 0;
}
.content-work:has(.map-editor) {
  max-width: none;
}
@media (max-width: 900px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
  .map-inspector {
    max-height: none;
  }
  .map-scroll {
    max-height: 45vh;
  }
  .rest-status {
    width: 85%;
    bottom: 190px;
    text-align: center;
  }
}

:root {
  --toolbar-height: min(104px, calc((100vw - 16px) * 0.13));
}
/* Keep both meters above the fixed 12-slot toolbar at every viewport width. */
.energy,
.health {
  bottom: calc(var(--toolbar-height) + 16px);
}
.world-status {
  position: fixed;
  top: 12px;
  left: 12px;
  width: max-content;
  max-width: calc(100vw - 190px);
  color: #ffe5b4;
  font-size: 16px;
  line-height: 1.5;
}
.world-info,
.world-money {
  padding: 8px 12px;
  background: #32271de8;
  border: 2px solid #b78b51;
  border-radius: 6px;
}
.world-info strong,
.world-info span {
  display: block;
}
.world-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-info span,
.world-money span {
  font-size: 14px;
}
.world-money {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.buffs {
  position: fixed;
  right: 12px;
  top: 62px;
}
@media (max-width: 650px) {
  .world-status {
    max-width: calc(100vw - 165px);
    left: 6px;
    top: 6px;
  }
  .world-info,
  .world-money {
    padding: 5px 7px;
  }
  .hud-buttons {
    margin-right: 6px;
  }
  .hud-link {
    padding: 8px;
    font-size: 14px;
  }
}

/* Original Cursors textures are drawn on the shop canvas; buttons are accessible hit areas. */
.shop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0008;
  display: flex;
  align-items: center;
  justify-content: center;
}
.original-shop {
  position: relative;
  outline: none;
}
.shop-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}
.shop-controls {
  position: absolute;
  inset: 0;
}
.shop-hit {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}
.shop-hit:focus-visible {
  outline: 3px solid #fff0b8;
  outline-offset: -5px;
}
.shop-hit:disabled {
  cursor: default;
}
