/* Shared NES/SNES JRPG look for the account, home, arena-admin and navigation pieces.
   Built from the drink page: PressStart2P font, flat blue windows with a white ridge border, green highlight. */
@font-face {
  font-family: nesFont;
  src: url(/css/font/PressStart2P-Regular.ttf);
}
:root {
  --blue: #0020c2;
  --blue-dark: #001070;
  --green: #00a060;
  --red: #c2182a;
  --accent: #ffd34d;      /* gold */
  --text: #ffffff;
  --muted: #b8c8ff;
  --bad: #ff9a9a;
  --good: #9affb0;
  --line: #ffffff;
}

/* ---- page ---- */
body.rpg {
  margin: 0;
  padding: 10px;
  color: #ffffff;
  text-shadow: 2px 2px #000000;
  background-color: #000000;
  font-family: nesFont, monospace;
  font-size: 16px;
  line-height: 1.8;
}
.rpg * { box-sizing: border-box; }
.rpg main { max-width: 1040px; margin: 0 auto; padding: 6px 0 40px; }
.rpg h1 { font-size: 24px; line-height: 1.4; margin: 14px 0 10px; font-weight: normal; }
.rpg h2 { font-size: 18px; line-height: 1.5; margin: 0 0 12px; color: var(--accent); font-weight: normal; }
.rpg h3 { font-size: 16px; margin: 6px 0; color: var(--accent); font-weight: normal; }
.rpg a { color: var(--accent); text-decoration: none; }
.rpg a:hover { color: #ffffff; text-decoration: underline; }
.rpg p { margin: 8px 0; }
.rpg hr { border: 0; border-top: 3px dotted rgba(255, 255, 255, .5); margin: 18px 0; }
.rpg small { font-size: 12px; }
.rpg img { image-rendering: pixelated; }
.rpg .muted { color: var(--muted); font-size: 12px; line-height: 1.9; }
.rpg .error, .rpg .auth_error { color: var(--bad); margin: 10px 0; }
.rpg .notice, .rpg .auth_notice { color: var(--good); margin: 10px 0; }

/* ---- windows ---- */
.rpg_box, .rpg .box {
  background-color: var(--blue);
  padding: 14px 16px;
  margin: 12px 2px;
  box-shadow: 5px 5px 5px #000000;
  border: 4px ridge #ffffff;
  border-radius: 10px;
}
.rpg .box.danger { background-color: #6a0e1a; }
.rpg .auth_box { max-width: 620px; margin: 24px auto; }

/* ---- navigation: little windows, like the drink page header ---- */
.nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; font-family: nesFont, monospace; font-size: 16px; }
.nav .spacer { flex: 1; }
.nav a, .nav .nav_text {
  display: inline-block;
  background-color: var(--blue);
  color: #ffffff;
  padding: 8px 12px;
  box-shadow: 4px 4px 4px #000000;
  border: 4px ridge #ffffff;
  border-radius: 10px;
  text-shadow: 2px 2px #000000;
  text-decoration: none;
  line-height: 1.4;
}
.nav a:hover { background-color: var(--green); text-decoration: none; color: #ffffff; }
.nav a.current { background-color: var(--green); }
.nav select { width: auto; max-width: 240px; }
.nav .nav_text { background-color: var(--blue-dark); }

.rpg .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.rpg .tabs a {
  background-color: var(--blue-dark);
  color: #ffffff;
  padding: 7px 10px;
  border: 3px ridge #ffffff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.rpg .tabs a:hover { background-color: var(--green); }
.rpg .tabs a.on { background-color: var(--green); }

/* ---- forms ---- */
.rpg label { display: block; margin-top: 12px; font-size: 16px; color: var(--muted); }
.rpg input[type=text], .rpg input[type=number], .rpg input[type=email], .rpg input[type=password],
.rpg input[type=file], .rpg select, .rpg textarea {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  background: #000000;
  color: #ffffff;
  border: 3px ridge #ffffff;
  border-radius: 6px;
  font-family: nesFont, monospace;
  font-size: 16px;
  text-shadow: none;
}
.rpg input:focus, .rpg select:focus, .rpg textarea:focus { outline: 3px solid var(--accent); }
.rpg textarea { min-height: 90px; }
.rpg input[type=file] { font-size: 12px; }
.rpg input[type=radio], .rpg input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); vertical-align: middle; margin: 0 6px 0 0; }
.rpg td input, .rpg td select { margin-top: 0; }

.rpg button, .rpg .button, .rpg input[type=submit] {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  background-color: var(--blue-dark);
  color: #ffffff;
  border: 4px ridge #ffffff;
  border-radius: 10px;
  box-shadow: 3px 3px 3px #000000;
  font-family: nesFont, monospace;
  font-size: 16px;
  line-height: 1.4;
  text-shadow: 2px 2px #000000;
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;      /* long button labels wrap instead of overflowing their window */
}
.rpg button:hover, .rpg .button:hover, .rpg input[type=submit]:hover { background-color: var(--green); }
.rpg button.secondary { background-color: #3a4a98; }
.rpg button.secondary:hover { background-color: var(--green); }
.rpg button.danger { background-color: var(--red); }
.rpg button.danger:hover { background-color: #e03a4a; }
.rpg td button { margin-top: 0; }
.rpg form.inline { display: inline; margin: 0; }

/* ---- tables and bits ---- */
.rpg table { width: 100%; border-collapse: collapse; }
.rpg th { text-align: left; padding: 6px 8px; font-size: 14px; color: var(--accent); font-weight: normal; }
.rpg td { padding: 8px; border-top: 2px dotted rgba(255, 255, 255, .4); vertical-align: middle; }
.rpg .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.rpg code.invite { background: #000000; padding: 4px 8px; border: 2px solid #ffffff; border-radius: 6px; word-break: break-all; font-family: nesFont, monospace; font-size: 16px; text-shadow: none; }
.rpg .auth_links { margin-top: 18px; font-size: 16px; }
.rpg .auth_links a { color: var(--accent); }
.icon_fallback { width: 64px; height: 64px; line-height: 64px; background: var(--accent); color: #222; text-align: center; font-size: 32px; text-shadow: none; border-radius: 8px; }

/* the arena picker in the navigation also appears on pages that don't use the .rpg body class */
.nav select {
  background: #000000;
  color: #ffffff;
  border: 3px ridge #ffffff;
  border-radius: 6px;
  padding: 4px 6px;
  font-family: nesFont, monospace;
  font-size: 16px;
  text-shadow: none;
}

/* the sign-out button in the navigation is a form button (signing out is a POST) styled like the links */
.nav form { display: inline; margin: 0; }
.nav button.navbtn, .nav form button {
  display: inline-block;
  background-color: var(--blue);
  color: #ffffff;
  padding: 8px 12px;
  box-shadow: 4px 4px 4px #000000;
  border: 4px ridge #ffffff;
  border-radius: 10px;
  text-shadow: 2px 2px #000000;
  font-family: nesFont, monospace;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  margin: 0;
}
.nav button.navbtn:hover, .nav form button:hover { background-color: var(--green); }

.nav .nav_text.paused { background-color: #a05a00; }

/* editable table rows (weapons, armor, members): keep names and menus readable at the larger text size */
.rpg td input[type=text] { min-width: 240px; }
.rpg td select { min-width: 200px; }
.rpg td input[type=number] { min-width: 80px; }

.rpg code { font-family: nesFont, monospace; font-size: inherit; color: var(--accent); text-shadow: none; }

/* ---- the manual training battle (/training); big tap targets so it works on a phone ---- */
.rpg .train .fighters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rpg .fighter {
  display: block; width: 100%; margin: 0; padding: 8px; text-align: left; min-height: 96px;
  background-color: var(--blue-dark); border-width: 3px; font-size: 12px; line-height: 1.5;
}
.rpg .fighter .name { font-size: 14px; word-break: break-word; }
.rpg .fighter .meta { color: var(--muted); font-size: 10px; margin-bottom: 4px; word-break: break-word; }
.rpg .fighter .nums { font-size: 10px; margin-bottom: 4px; }
.rpg .fighter:disabled { cursor: default; opacity: 1; color: #ffffff; }
.rpg .fighter:disabled:hover { background-color: var(--blue-dark); }
.rpg .fighter.dead { filter: grayscale(1); opacity: .6; }
.rpg .fighter.acting { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent), 3px 3px 3px #000000; }
.rpg .fighters.selecting .fighter:disabled { opacity: .4; }
.rpg .fighters.selecting .fighter.acting:disabled { opacity: 1; }
.rpg .fighter.targetable { border-color: var(--good); animation: pulse 1s infinite alternate; cursor: pointer; }
.rpg .fighter.targetable:hover { background-color: var(--green); }
@keyframes pulse { from { box-shadow: 0 0 0 2px var(--good); } to { box-shadow: 0 0 0 5px var(--good); } }
.rpg .bar { height: 10px; background: #000000; border: 2px solid #ffffff; border-radius: 4px; overflow: hidden; }
.rpg .bar .fill { height: 100%; background: var(--blue-dark); }
.rpg .bar.hp .fill.high { background: #2fd05a; }
.rpg .bar.hp .fill.mid { background: #e8c22d; }
.rpg .bar.hp .fill.low { background: #e03a4a; }
.rpg .bar.mp .fill { background: #4aa3ff; }
.rpg .controls .actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rpg button.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%;
  min-height: 64px; margin: 0; padding: 8px; font-size: 18px; background-color: #3a4a98;
}
.rpg button.action.wide { margin-top: 8px; }
.rpg button.action .hint { font-size: 10px; color: var(--muted); margin-top: 4px; }
.rpg button.action:disabled { opacity: .45; cursor: default; }
.rpg button.action:disabled:hover { background-color: #3a4a98; }
.rpg .controls .prompt { color: var(--good); }
.rpg .battlelog { max-height: 220px; overflow-y: auto; font-size: 12px; line-height: 1.7; }
.rpg .battlelog .line { color: var(--muted); }
.rpg .battlelog .line.fresh { color: #ffffff; }
.rpg .battlelog .line.round { color: var(--accent); margin-top: 6px; }
@media (min-width: 700px) { .rpg .controls .actions { grid-template-columns: repeat(4, 1fr); } }

/* the Watch / Stats / Manage / Leave links on the home page's arena rows wrap instead of running out of the window */
.rpg .rowactions { text-align: right; white-space: nowrap; }
.rpg .rowactions > a.button, .rpg .rowactions form.inline { margin: 0 0 0 6px; }
.rpg .rowactions a.button { margin-top: 0; }
.rpg a.button.secondary { background-color: #3a4a98; color: #ffffff; }
.rpg a.button.secondary:hover { background-color: var(--green); text-decoration: none; }
.rpg table.arenatable th, .rpg table.arenatable td:nth-child(2), .rpg table.arenatable td:nth-child(3) { white-space: nowrap; }
.rpg table.arenatable td:first-child select { min-width: 0; width: 270px; max-width: 100%; }
.rpg .rowactions form.inline { display: inline-block; }
.rpg .rowactions button { margin-top: 0; }
@media (max-width: 700px) {
  .rpg .rowactions { text-align: left; white-space: normal; line-height: 2.6; }
  .rpg .rowactions > a.button, .rpg .rowactions form.inline { margin: 0 6px 0 0; }
}
@media (max-width: 700px) {
  /* one stacked card per arena instead of a table that is wider than the screen */
  .rpg table.arenatable, .rpg table.arenatable tbody, .rpg table.arenatable tr, .rpg table.arenatable td { display: block; width: 100%; }
  .rpg table.arenatable tr:first-child { display: none; }
  .rpg table.arenatable tr { border-top: 2px dotted rgba(255, 255, 255, .4); padding: 6px 0; }
  .rpg table.arenatable td { border: 0; padding: 2px 8px; }
  .rpg table.arenatable td select { min-width: 0; width: 100%; }
  .rpg table.arenatable td:nth-child(2)::before { content: 'Role: '; color: var(--muted); }
  .rpg table.arenatable td:nth-child(3)::before { content: 'Members: '; color: var(--muted); }
}
.rpg .rowactions a.button, .rpg .rowactions button { padding: 6px 9px; font-size: 14px; }
.rpg table.arenatable td:first-child select { width: 230px; }
.rpg table.arenatable th, .rpg table.arenatable td { padding-left: 6px; padding-right: 6px; }
