:root {
  --bg-grass: #5c9434;
  --wood-dark: #3a1e05;
  --wood-light: #7c4819;
  --parchment: #f2e3bc;
  --btn-green: #388e3c;
  --btn-green-hover: #4caf50;
  --btn-red: #a53030;
  --btn-red-hover: #c74040;
}

* {
  box-sizing: border-box;
  font-family: "Press Start 2P", monospace;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-grass);
  /* 32x32 pixel grass pattern made purely with CSS gradients */
  background-image:
    radial-gradient(#4d8029 15%, transparent 16%),
    radial-gradient(#4d8029 15%, transparent 16%);
  background-size: 32px 32px;
  background-position:
    0 0,
    16px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  image-rendering: pixelated;
}

/* Account page scrolls and starts at the top instead of centered */
body.page-account {
  align-items: flex-start;
  padding: 40px 16px;
}

/* Shared card look (login and account box) */
.login-box,
.account-box {
  background: var(--parchment);
  border: 6px solid var(--wood-dark);
  outline: 4px solid var(--wood-light);
  padding: 30px 24px;
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.4);
}

.login-box {
  width: 340px;
  text-align: center;
}

.account-box {
  width: 420px;
  max-width: 100%;
}

h1 {
  font-size: 13px;
  color: var(--wood-dark);
  margin-bottom: 24px;
  line-height: 1.5;
}

.account-box h1 {
  font-size: 14px;
  margin: 0 0 4px;
  text-align: center;
}

.subtitle {
  font-size: 8px;
  color: var(--wood-light);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

label {
  display: block;
  font-size: 9px;
  color: var(--wood-dark);
  margin-bottom: 8px;
}

input {
  width: 100%;
  padding: 10px;
  font-size: 9px;
  background: #fff;
  border: 3px solid var(--wood-dark);
  box-shadow: inset 3px 3px 0px #d0d0d0;
  outline: none;
}

input:focus {
  background: #ffffea;
  border-color: var(--wood-light);
}

/* Pixel button with an inset effect when pressed */
.btn-pixel {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  font-size: 10px;
  color: white;
  background: var(--btn-green);
  border: 3px solid var(--wood-dark);
  box-shadow: inset -3px -3px 0px #1f5022;
  cursor: pointer;
}

.btn-pixel:hover {
  background: var(--btn-green-hover);
}

.btn-pixel:active {
  box-shadow: inset 3px 3px 0px #1f5022;
  transform: translate(2px, 2px);
}

/* ===== Login page ===== */

/* Switcher between login and register */
.switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border: 3px solid var(--wood-dark);
}

.switcher button {
  flex: 1;
  padding: 10px 4px;
  font-size: 9px;
  color: var(--wood-dark);
  background: #d8c48f;
  border: none;
  cursor: pointer;
}

.switcher button.active {
  color: white;
  background: var(--btn-green);
}

/* Fields visible only in register mode */
.register-only {
  display: none;
}

body.mode-register .register-only {
  display: block;
}

.switch-hint {
  margin-top: 18px;
  font-size: 8px;
  line-height: 1.6;
  color: var(--wood-light);
}

/* ===== Account page ===== */

/* Avatar area */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 3px dashed var(--wood-light);
}

.avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: #d8c48f;
  border: 3px solid var(--wood-dark);
  box-shadow: inset 3px 3px 0px #b8a06f;
}

.avatar-info .name {
  font-size: 11px;
  color: var(--wood-dark);
  margin-bottom: 8px;
}

.avatar-info .joined {
  font-size: 7px;
  color: var(--wood-light);
  line-height: 1.6;
}

/* Section headings */
h2 {
  font-size: 10px;
  color: var(--wood-dark);
  margin: 24px 0 14px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--wood-dark);
}

/* Toggle rows for settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 9px;
  color: var(--wood-dark);
}

.toggle {
  width: 44px;
  height: 22px;
  flex-shrink: 0;
  background: #c0402f;
  border: 3px solid var(--wood-dark);
  cursor: pointer;
  position: relative;
  padding: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  background: var(--parchment);
  transition: left 0.08s steps(2);
}

.toggle.on {
  background: var(--btn-green);
}

.toggle.on::after {
  left: 22px;
}

.btn-danger {
  background: var(--btn-red);
  box-shadow: inset -3px -3px 0px #6e1e1e;
}

.btn-danger:hover {
  background: var(--btn-red-hover);
}

.btn-danger:active {
  box-shadow: inset 3px 3px 0px #6e1e1e;
}

/* Danger Zone */
.danger-zone {
  margin-top: 28px;
  padding: 18px;
  border: 3px solid var(--btn-red);
  background: #f3d6cf;
}

.danger-zone h2 {
  color: var(--btn-red);
  border-color: var(--btn-red);
  margin-top: 0;
}

.danger-zone p {
  font-size: 8px;
  line-height: 1.7;
  color: #7a2020;
  margin: 0 0 14px;
}

/* Footer with back link */
.footer-links {
  margin-top: 24px;
  text-align: center;
  font-size: 8px;
  line-height: 1.8;
}

.footer-links a {
  color: var(--wood-light);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--wood-dark);
  text-decoration: underline;
}

/* Short confirmation message */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wood-dark);
  color: var(--parchment);
  font-size: 9px;
  padding: 12px 18px;
  border: 3px solid var(--wood-light);
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.toast.show {
  opacity: 1;
}
