#save-warning { position: fixed; z-index: 600; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(410px, calc(100vw - 32px)); box-sizing: border-box; padding: 14px 18px; border: 3px solid var(--ink); background: var(--parchment); color: var(--ink); border-radius: 10px; box-shadow: var(--ledge); font: 14px/1.5 var(--read); text-shadow: none; }
#save-warning[hidden] { display: none; }
/* On a phone it comes in over the world, never over the stick, the chat or the dock (as the journal's news: journal.css). */
@media (max-width: 760px), (pointer: coarse) { #save-warning { top: calc(max(8px, env(safe-area-inset-top)) + 160px); bottom: auto; width: min(360px, calc(100vw - 24px)); } }
@media (pointer: coarse) and (max-height: 500px) { #save-warning { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); width: min(340px, calc(100vw - 240px)); padding: 10px 14px; font-size: 13px; line-height: 1.4; } }
#save-warning p { margin: 6px 0 0; }
/* Idle warnings stay above the HUD without blocking the game or stealing focus. */
#idle-warning { position: fixed; z-index: 500; top: 18px; left: 50%; transform: translateX(-50%); width: min(360px, calc(100vw - 32px)); box-sizing: border-box; padding: 16px 20px; border: 3px solid var(--ink); border-radius: 12px; corner-shape: bevel; background: var(--parchment); color: var(--ink); box-shadow: var(--bevel), var(--ledge); text-shadow: none; text-align: center; }
#idle-warning strong { font: 16px/1.4 var(--blocks); color: var(--leaf-deep); }
#idle-stay { padding: 9px 18px; background: var(--evergreen); border: 2px solid var(--ink); border-radius: 6px; corner-shape: bevel; color: var(--paper); font: 800 14px var(--read); cursor: pointer; box-shadow: var(--ledge); }
#idle-stay:hover { filter: brightness(1.1); }
#idle-stay:active { transform: translateY(2px); box-shadow: none; }
#idle-warning[hidden] { display: none; }
#idle-warning p { margin: 8px 0 12px; line-height: 1.45; font-size: 14px; }
.session-note { font-size: 12px; line-height: 1.5; opacity: .85; }
/* The front door: the login card and the character creator, in the interface kit's carved frame (kit.css),
   over a picture of the town taken in the game itself (art/login-town.jpg, with the older drawn landscape
   underneath while it loads). On a wide screen the card stands to the left so the town shows beside it. */
#login {
  position: absolute; inset: 0; z-index: 50; overflow: hidden auto;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: #9fd2e8 url('../art/frontier.svg') center bottom / cover no-repeat;
  color: var(--ink); text-shadow: none;
}
#login::before {   /* the town, drifting slowly as if seen from a passing cloud */
  content: ''; position: fixed; inset: -3%; z-index: -1;
  background: url('../art/login-town.jpg') 62% 40% / cover no-repeat;
  animation: login-drift 60s ease-in-out infinite alternate;
}
#login::after {   /* a soft warm light over the picture, darker at the card's side so the card stands out */
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(43, 29, 14, 0.34), rgba(43, 29, 14, 0.06) 48%, rgba(255, 236, 190, 0.08));
}
@keyframes login-drift { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.07) translate(-1.5%, 0.8%); } }
@media (min-width: 1100px) { #login { justify-content: flex-start; padding-left: max(5vw, 32px); } }

/* ---- The card ---- */
.login-box {
  position: relative; width: 460px; max-width: 100%; max-height: 100%; overflow-y: auto; margin: auto 0;
  padding: 18px 26px 14px; text-align: center;
  background: var(--parchment); border: 3px solid var(--ink); border-radius: 14px; corner-shape: bevel;
  box-shadow: var(--bevel), 0 6px 0 rgba(43, 29, 14, 0.45), 0 18px 40px rgba(20, 30, 20, 0.35);
  scrollbar-width: thin; scrollbar-color: #c9a25a transparent;
}
@media (min-width: 1100px) { .login-box { margin: auto 0; } }
.login-box h1 { margin: 2px 0 4px; line-height: 0; }
#login .login-box h1 .logo { width: 100%; max-width: 380px; height: auto; filter: drop-shadow(0 3px 0 rgba(90, 60, 20, 0.16)); animation: logo-float 4.5s ease-in-out infinite; }
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.tagline { margin: 6px auto 12px; max-width: 340px; color: #6a5030; font: 700 13.5px/1.5 var(--read); }

/* A message when something went wrong: a red chip, only when it has something to say. */
#login-error { margin: 0 auto 8px; color: #fff6de; font: 800 12.5px/1.35 var(--read); }
#login-error:empty { display: none; }
#login-error:not(:empty) { display: inline-block; padding: 5px 12px; background: linear-gradient(#e0574a, #b93a2f); border: 2px solid var(--ink); border-radius: 8px; corner-shape: bevel; box-shadow: 0 2px 0 rgba(43, 29, 14, 0.4); }

/* ---- Fields ---- */
.login-fields { display: grid; gap: 8px; margin: 4px 0 12px; text-align: left; }
.login-fields label { display: grid; gap: 4px; font: 16px/1 var(--blocks); color: var(--brown); letter-spacing: 0.04em; }
.login-fields input {
  width: 100%; height: 38px; padding: 0 12px; color: var(--ink); font: 800 15px var(--read);
  background: #fffdf6; border: 2px solid var(--ink); border-radius: 8px; corner-shape: bevel;
  box-shadow: inset 0 3px 0 rgba(160, 110, 40, 0.16);
}
.login-fields input:focus { outline: 0; border-color: var(--leaf-deep); box-shadow: inset 0 3px 0 rgba(160, 110, 40, 0.16), 0 0 0 3px var(--honey); }

/* ---- Buttons: honey, with the main one evergreen ---- */
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.buttons button {
  min-height: 38px; padding: 0 12px; cursor: pointer; color: var(--ink); font: 800 13px var(--read);
  background: linear-gradient(#ffe27a, #f0b93a); border: 2px solid var(--ink); border-radius: 9px; corner-shape: bevel;
  box-shadow: inset 0 -3px 0 rgba(150, 90, 10, 0.3), 0 3px 0 rgba(43, 29, 14, 0.35);
}
.buttons button:hover { background: linear-gradient(#fff0a8, #f6c531); }
.buttons button:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(150, 90, 10, 0.32); }
.buttons button.primary { grid-column: 1 / -1; min-height: 44px; color: var(--paper); font: 16px/1 var(--blocks); letter-spacing: 0.05em; text-shadow: 0 2px 0 var(--ink); background: var(--evergreen); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 0 rgba(43, 29, 14, 0.35); }
.buttons button.primary:hover { background: linear-gradient(#78c07e 0 3px, #4f9d5c 3px calc(100% - 4px), #347a45 calc(100% - 4px)); }
.buttons button.quiet { background: var(--raised); }

.footer { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; color: #8a7a60; font: 700 11px var(--read); }
#login #login-status::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; background: #b8a778; clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%); }
#login #login-status.ok::before { background: var(--honey); }
#login .footer .about { margin-left: 12px; color: var(--leaf-deep); font-weight: 800; text-decoration: none; }
#login .footer .about:hover { text-decoration: underline; }

/* ---- The character creator: the figure on its plinth, the choices beside it, the calling below ---- */
#login.creating .login-box { width: 700px; }
#login.creating .login-box h1 .logo { max-width: 200px; }
#login.creating .tagline { display: none; }
#create h2 { margin: 0 0 8px; font: 16px/1 var(--blocks); letter-spacing: 0.05em; color: var(--leaf-deep); }
.design { display: grid; grid-template-columns: 196px 1fr; gap: 14px; align-items: start; text-align: left; }
.design-stage { display: grid; justify-items: center; }
.design-side { display: grid; gap: 8px; }
#create .buttons.surprise { grid-template-columns: 1fr; }   /* (over the three-button row below) */
.buttons.surprise button { min-height: 32px; }
#design-preview {
  width: 180px; height: 240px; display: block;
  background: radial-gradient(ellipse 70% 16% at 50% 88%, rgba(120, 170, 70, 0.55), transparent 70%), linear-gradient(#bfe4f5 0%, #e6f5ea 62%, #b7d98a 62.5%, #9cc86a 100%);
  border: 3px solid var(--ink); border-radius: 12px; corner-shape: bevel; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.6), 0 3px 0 rgba(43, 29, 14, 0.35);
}
.design-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.pick {
  display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; min-height: 40px;
  background: #fffaf0; border: 2px solid var(--ink); border-radius: 8px; corner-shape: bevel; box-shadow: 0 2px 0 rgba(43, 29, 14, 0.25);
}
.pick .what { grid-column: 2; grid-row: 1; align-self: end; text-align: center; font: 8px/1 var(--blocks); letter-spacing: 0.06em; color: var(--brown); text-transform: uppercase; padding-top: 4px; }
.pick .val { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; gap: 6px; padding-bottom: 4px; font: 800 13px/1.2 var(--read); color: var(--ink); white-space: nowrap; overflow: hidden; }
.pick .val .n { color: #9a8460; font-size: 11px; }
.pick .sw { width: 18px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.45), inset -1px -2px 0 rgba(0, 0, 0, 0.18); }
/* A colour's row of swatches, every one a button; the chosen one stands up with a honey ring. */
.pick .swatches { display: flex; gap: 2px; width: 100%; justify-content: center; padding: 0 4px; }
.pick .swatches .sw { display: block; grid-row: auto; flex: 1 1 0; min-width: 8px; max-width: 18px; height: 14px; padding: 0; border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; }
.pick .swatches .sw::before { content: none; }   /* (not a stepper's pixel arrow) */
.pick .swatches .sw.on { border-width: 2px; outline: 2px solid var(--honey); outline-offset: 0; transform: translateY(-2px); }
.pick .swatches .sw:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.pick button {
  grid-row: 1 / span 2; align-self: stretch; display: grid; place-items: center; min-height: 0; padding: 0; cursor: pointer; border: 0; font-size: 0;
  background: linear-gradient(#ffe27a, #f0b93a);
}
.pick button::before { content: ''; width: 8px; height: 12px; background: var(--ink); }   /* a pixel arrow */
.pick .prev::before { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.pick .next::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.pick .prev { grid-column: 1; border-right: 2px solid var(--ink); border-radius: 6px 0 0 6px; }
.pick .next { grid-column: 3; border-left: 2px solid var(--ink); border-radius: 0 6px 6px 0; }
.pick button:hover { background: linear-gradient(#fff0a8, #f6c531); }
.pick button:active { background: linear-gradient(#f0b93a, #ffe27a); }

.vocations { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 8px; text-align: left; }
.vocations .voc {
  display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; align-content: start; padding: 7px 8px; cursor: pointer;
  background: #fffaf0; border: 2px solid var(--ink); border-radius: 9px; corner-shape: bevel; box-shadow: 0 3px 0 rgba(43, 29, 14, 0.25);
}
.vocations .voc:hover { background: #fff3cf; }
.vocations .voc.active { background: linear-gradient(#fff6c8, #ffe28a); box-shadow: 0 0 0 3px var(--honey), 0 3px 0 rgba(43, 29, 14, 0.35); }
.vocations .voc .vi { grid-row: 1 / span 2; width: 34px; height: 34px; image-rendering: pixelated; }
.vocations .voc .vt { font: 16px/1 var(--blocks); letter-spacing: 0.04em; color: var(--ink); align-self: end; }
.vocations .voc .vs { display: flex; align-items: center; gap: 4px; font: 800 11px var(--read); color: #6a5030; }
.vocations .voc .vs img { width: 12px; height: 12px; image-rendering: pixelated; }
.vocations .voc .d { grid-column: 1 / -1; margin-top: 3px; font: 700 11px/1.3 var(--read); color: #6a5030; }
.create-fields:not(:empty) { margin: 2px 0 10px; }
.create-fields .login-fields { grid-template-columns: 1fr 1fr; margin: 0; }
.create-fields .login-fields::after { content: 'A name and password keep your character. Or play as a guest.'; grid-column: 1 / -1; font: 700 11px var(--read); color: #8a7a60; }
#create .buttons { grid-template-columns: 1.4fr 1fr 0.7fr; }
#create .buttons button.primary { grid-column: auto; }

@media (max-width: 760px) {
  #login.creating .login-box { width: 460px; }
  .design { grid-template-columns: 1fr; justify-items: center; }
  .design-buttons { width: 100%; }
  .vocations { grid-template-columns: 1fr; }
  .create-fields .login-fields, #create .buttons { grid-template-columns: 1fr; }
}
@media (max-height: 800px) { #login.creating .footer { display: none; } }   /* room for the creator: the server line can wait */
@media (max-height: 700px) {
  #login .login-box h1 .logo { max-width: 300px; }
  #login.creating .login-box h1 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #login::before, #login .login-box h1 .logo { animation: none; }
}
body.demo #login { display: none !important; }

.quickplay-note {grid-column:1/-1;text-align:center;font:600 12px/1.4 var(--read);color:#5c513b;}
/* The Pioneers (server/pioneers.js): while places are left, a honey note under Play now says so (main.js pioneerNote). */
.pioneer-note {grid-column:1/-1;justify-self:center;max-width:34em;margin:0;padding:5px 12px;border:1px solid #d9a93f;border-radius:8px;corner-shape:bevel;background:linear-gradient(180deg,#fff3c4,#f7d77f);color:#4a3410;font:700 12px/1.4 var(--read);text-align:center;}
.pioneer-note[hidden] {display:none;}
