/* Minecraft Rust website: a Java Edition style menu. Textures and the pixel font come from the
   game's own 26.3 jar (scripts/export_menu_assets.py); the panorama is our own world. */
@font-face { font-family: "MinecraftRust"; src: url("/static/menu/mc.ttf") format("truetype"); font-display: block; }

:root { --btn: 2px; --text: #ffffff; --shadow: #3f3f3f; --grey: #a0a0a0; --yellow: #ffff55; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh; background: #1d2a17; color: var(--text); overflow-x: hidden;
  font: 16px/1.25 "MinecraftRust", ui-monospace, monospace; -webkit-font-smoothing: none; text-rendering: optimizeSpeed;
  text-shadow: 2px 2px 0 var(--shadow);
}
a { color: #55ffff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The world behind the menu: a slow pan around the 360-degree panorama. */
.panorama {
  position: fixed; inset: -12px; z-index: 0;
  background: #87a8e6 url("/static/menu/panorama.jpg") repeat-x 0 50% / auto 100%;
  animation: pan 260s linear infinite;
}
@keyframes pan { to { background-position-x: -449.28vh; } }
.shade { position: fixed; inset: 0; z-index: 0; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 40%, rgba(0,0,0,.45) 100%); }
.login-mode .panorama { filter: blur(6px) brightness(.85); }
.login-mode .shade { background: rgba(0,0,0,.35); }
@media (prefers-reduced-motion: reduce) { .panorama { animation: none; } }

.menu { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 16px 16px 40px; min-height: 100vh; }

/* Title: the blocky 3D word art is drawn on a canvas by menu.js. */
.logo { position: relative; margin: 0 0 10px; width: min(640px, 100%); line-height: 0; }
.logo canvas { width: 100%; height: auto; display: block; }
.splash {
  position: absolute; right: 2%; bottom: 18%; color: var(--yellow); text-shadow: 2px 2px 0 #3f3f15;
  font-size: 16px; line-height: 1; white-space: nowrap; transform: rotate(-20deg); transform-origin: 50% 50%;
  animation: splash .55s ease-in-out infinite alternate;
}
@keyframes splash { from { transform: rotate(-20deg) scale(1); } to { transform: rotate(-20deg) scale(1.1); } }

/* Buttons and text fields use the game's nine-slice sprites at 2x. */
.mc-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border: 6px solid transparent; border-image: url("/static/menu/button.png") 3 fill / 6px stretch; image-rendering: pixelated;
  background: none; color: var(--text); font: inherit; text-shadow: inherit; text-decoration: none; cursor: pointer; user-select: none;
}
.mc-button:hover, .mc-button:focus-visible, .mc-button.active { border-image-source: url("/static/menu/button_highlighted.png"); outline: none; }
.mc-button.active { color: var(--yellow); }
.mc-button:disabled, .mc-button.disabled { border-image-source: url("/static/menu/button_disabled.png"); color: var(--grey); text-shadow: none; cursor: default; pointer-events: none; }
.mc-field {
  display: block; width: 100%; height: 40px; margin-top: 6px; padding: 0 10px; color: #e0e0e0; font: inherit; text-shadow: none;
  border: 2px solid transparent; border-image: url("/static/menu/text_field.png") 1 fill / 2px stretch; image-rendering: pixelated; background: none; outline: none;
}
.mc-field:focus { border-image-source: url("/static/menu/text_field_highlighted.png"); }
.mc-field::placeholder { color: #707070; }
label { display: block; margin: 12px 0 0; color: var(--grey); }
.hint { color: var(--grey); margin: 10px 0 0; }
.feedback { min-height: 20px; margin: 10px 0 0; color: #55ff55; }
.feedback.error { color: #ff5555; }
h2 { font-weight: normal; font-size: 16px; margin: 0 0 8px; text-align: center; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row > * { flex: 1; }

/* Sign-in screen */
.panel { width: min(400px, 100%); }
.panel form .mc-button, .panel > .mc-button { width: 100%; margin-top: 16px; }
.tabs { margin-top: 0; }
.or { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--grey); }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: rgba(255,255,255,.25); box-shadow: 2px 2px 0 var(--shadow); }
.g-icon { width: 20px; height: 20px; flex: none; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); box-shadow: 2px 2px 0 var(--shadow); }

/* Title screen: player on the left, the square Play button, account buttons on the right. */
.title-screen { display: grid; grid-template-columns: 240px auto 200px; align-items: center; gap: 40px; width: min(960px, 100%); }
.player-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.nametag { background: rgba(0,0,0,.4); padding: 4px 10px 2px; text-shadow: none; }
.skin-stage { position: relative; width: 220px; height: 262px; perspective: 900px; cursor: grab; touch-action: none; }
.skin-stage:active { cursor: grabbing; }
.player-card .mc-button { width: 200px; }
.play-column { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.play-square { width: 200px; height: 200px; flex-direction: column; gap: 16px; border-width: 9px; border-image-width: 9px; }
.play-icon { width: 56px; height: 64px; background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); filter: drop-shadow(4px 4px 0 var(--shadow)); }
.play-square.disabled .play-icon { background: var(--grey); filter: none; }
.play-label { font-size: 32px; line-height: 1; text-shadow: 4px 4px 0 var(--shadow); }
.play-square.disabled .play-label { text-shadow: none; }
.status { margin: 0; color: var(--grey); text-align: center; }
.status.online { color: #55ff55; }
.side-buttons { display: flex; flex-direction: column; gap: 8px; }
.side-buttons .mc-button { width: 100%; }

/* The player model: boxes with the skin on each face (built by menu.js). */
.mc-player { position: absolute; left: 50%; bottom: 20px; width: 0; height: 0; transform-style: preserve-3d; }
.mc-part { position: absolute; transform-style: preserve-3d; }
.mc-face { position: absolute; background-repeat: no-repeat; image-rendering: pixelated; backface-visibility: hidden; }

/* Dialogs */
.mc-dialog { width: min(420px, calc(100vw - 32px)); padding: 18px; color: var(--text); background: rgba(0,0,0,.82); border: 2px solid #000; box-shadow: 0 0 0 2px #555; }
.mc-dialog.wide { width: min(560px, calc(100vw - 32px)); }
.mc-dialog::backdrop { background: rgba(0,0,0,.5); }
.skin-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; min-height: 230px; }
.skin-grid button { position: relative; height: 112px; padding: 0; border: 2px solid transparent; background: rgba(255,255,255,.08); cursor: pointer; }
.skin-grid button:hover, .skin-grid button:focus-visible { background: rgba(255,255,255,.25); outline: none; }
.skin-grid button.worn { border-color: var(--yellow); }
.skin-grid canvas { width: 48px; height: 96px; image-rendering: pixelated; }

.corner { position: fixed; bottom: 6px; z-index: 1; color: #fff; font-size: 16px; }
.corner.left { left: 8px; }
.corner.right { right: 8px; }

@media (max-width: 820px) {
  .title-screen { grid-template-columns: 1fr; justify-items: center; gap: 20px; }
  .side-buttons { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .side-buttons .mc-button { width: auto; }
  .skin-grid { grid-template-columns: repeat(4, 1fr); }
  .corner { position: static; text-align: center; display: block; padding: 4px 16px; }
  .splash { font-size: 12px; }
}
