/* shared-theme.css — Medieval-MMO visual language.
   Used by: info/, guide/, forum/
   Does NOT replace: css/variables.css, css/main.css (legacy) */

@import url('design-tokens.css');

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 12px;
  background:
    radial-gradient(circle at 20% 0%, #34483e 0%, transparent 36%),
    radial-gradient(circle at 88% 14%, #3a2f26 0%, transparent 40%),
    linear-gradient(140deg, var(--bg-deep) 0%, var(--bg-mid) 52%, var(--bg-soft) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3 {
  font-family: "Copperplate", "Times New Roman", serif;
  color: var(--ink);
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.14s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Buttons */
input[type="button"],
input[type="submit"],
input[type="reset"],
button {
  background: linear-gradient(160deg, #2e4758, #1c303e);
  border: 1px solid rgba(34, 52, 66, 0.55);
  border-radius: 10px;
  color: #eef4f8;
  padding: 7px 12px;
  min-height: 30px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  background: linear-gradient(160deg, #45657d, #2a4558);
}

/* Utility: Card */
.card {
  border: 1px solid rgba(98, 80, 48, 0.2);
  background: linear-gradient(180deg, var(--paper), var(--paper-dim));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

/* Building page container */
.building-page {
  max-width: 980px; margin: 0 auto; padding: 0 8px;
}

/* Error/success message — parchment card style */
.msg-error, .msg-success {
  text-align: center; margin: 10px 0 14px; font-weight: 600; font-size: 13px;
  padding: 10px 18px; border-radius: var(--radius-md, 8px);
  background: linear-gradient(180deg, var(--paper, #f0e6d2), var(--paper-dim, #e4d8c1));
  border: 1px solid rgba(98, 80, 48, 0.2);
  box-shadow: var(--shadow-soft, 0 2px 6px rgba(0,0,0,0.08));
}
.msg-error { color: var(--warn, #8f2b2b); }
.msg-success { color: var(--ok, #2f6f3f); }

/* Building navigation (shop floors, dealer masters, temple sections) */
.building-nav {
  display: flex; justify-content: center; gap: 10px;
  margin: 10px 0 14px; flex-wrap: wrap;
}
.building-nav a {
  display: inline-block; padding: 6px 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--paper), var(--paper-dim));
  border: 1px solid rgba(98, 80, 48, 0.18);
  color: var(--ink) !important;
  font-weight: 600; font-size: 12px;
  text-decoration: none; transition: all 0.18s ease;
}
.building-nav a:hover {
  background: linear-gradient(160deg, #2e4758, #1c303e);
  border-color: rgba(34, 52, 66, 0.55);
  color: #eef4f8 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.building-nav-label {
  display: block; font-size: 9px;
  color: rgba(200, 184, 150, 0.7); margin-top: 3px;
  font-style: italic; text-align: center;
}

/* Filter bar (shop, dealers, university, auction) */
.filter-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap; padding: 10px 12px;
  background: linear-gradient(180deg, var(--paper), var(--paper-dim));
  border: 1px solid rgba(98, 80, 48, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.filter-bar b, .filter-bar label {
  font-size: 12px; color: var(--ink);
}
.filter-bar label { cursor: pointer; }
.filter-bar input[type="text"], .filter-bar select {
  padding: 3px 6px; border: 1px solid rgba(200, 184, 150, 0.5);
  border-radius: 6px; background: rgba(255, 252, 245, 0.95);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 11px; color: var(--ink);
  width: 50px; text-align: center;
}
.filter-bar input[type="text"].filter-wide { width: 70px; }
.filter-bar select { width: auto; text-align: left; appearance: auto; cursor: pointer; }
.filter-bar input[type="submit"], .filter-bar button {
  padding: 3px 10px; border: 1px solid rgba(200, 184, 150, 0.4);
  border-radius: 6px; background: rgba(255, 255, 255, 0.6);
  color: #2f3a45; font-weight: 700; font-size: 11px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  cursor: pointer; transition: all 0.14s ease;
}
.filter-bar input[type="submit"]:hover, .filter-bar button:hover {
  background: linear-gradient(160deg, #2e4758, #1c303e);
  color: #eef4f8; border-color: rgba(34, 52, 66, 0.55);
}

/* Item icon grid (category icons in shop/dealers) */
.item-icons {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  margin: 10px auto; text-align: center;
}
.item-icons div, .item-icons .ahint {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
}

/* Quantity control (buy X items): [▲] [input] [▼] */
.quantity-control {
  display: inline-flex; align-items: center; vertical-align: middle;
  gap: 4px;
}
.quantity-control input[type="text"], .quantity-control input.login {
  width: 38px; height: 30px; text-align: center;
  margin: 0; padding: 0;
  border: 1px solid rgba(200, 184, 150, 0.5);
  border-radius: 6px;
  background: rgba(255, 252, 245, 0.95);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 13px; font-weight: 700; line-height: 30px;
  color: var(--ink); box-sizing: border-box;
}
.quantity-btn {
  display: block;
  width: 30px; height: 30px;
  padding: 0; margin: 0;
  border: 1px solid rgba(34, 52, 66, 0.55);
  border-radius: 6px;
  background: linear-gradient(160deg, #2e4758, #1c303e);
  cursor: pointer;
  font-size: 0; color: transparent;
  box-sizing: border-box;
  transition: background 0.14s ease;
  position: relative;
}
.quantity-btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}
.quantity-btn-up::after {
  border-bottom: 6px solid #eef4f8;
}
.quantity-btn-down::after {
  border-top: 6px solid #eef4f8;
}
.quantity-btn:hover {
  background: linear-gradient(160deg, #45657d, #2a4558);
}

/* Item card (shop, dealers, university, mine, auction, alchemy, inventory) */
.weapons_box {
  background: linear-gradient(180deg, var(--paper), var(--paper-dim));
  border: 1px solid rgba(98, 80, 48, 0.18);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 12px;
  padding: 10px 12px;
}
.weapons_box td {
  padding: 1px 6px;
  vertical-align: top;
}

/* Item action button (buy, sell, equip, learn) */
.inv_but {
  background: linear-gradient(160deg, #2e4758, #1c303e);
  border: 1px solid rgba(34, 52, 66, 0.55);
  border-radius: 6px;
  color: #eef4f8;
  padding: 4px 12px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
.inv_but:hover {
  background: linear-gradient(160deg, #45657d, #2a4558);
  box-shadow: var(--shadow-soft);
}
/* "Осталось: X шт." — текстовый контекст, не кнопка */
b.inv_but {
  all: unset;
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 11px;
  font-style: italic;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

/* Utility: Pill */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(98, 80, 48, 0.22);
  color: #2f3a45;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.pill:hover {
  background: linear-gradient(160deg, #39576d, #253c4c);
  color: #e9eef3;
}

/* === Pers Tab: 3-column grid layout === */
.pers-3col-grid {
    display: grid;
    grid-template-columns: 250px 320px 1fr;
    column-gap: 10px;
    padding: 10px 0 0 10px;
    min-height: 460px;
    width: 100%;
}

.pers-stats-column {
    text-align: center;
    height: 100%;
}

.pers-stats-column > .pers-stats-inner {
    height: 100%;
    text-align: left;
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Pers left column: parchment stat cards */
.pers-stats-column .stats-card {
    background: linear-gradient(180deg, #e8dfc8 0%, #d4c8a8 100%);
    border: 1px solid rgba(180, 160, 120, 0.6);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 10px 12px;
}

.pers-stats-column .block-title {
    font-family: 'Copperplate Gothic', 'Copperplate', 'Times New Roman', serif;
    font-weight: bold;
    font-size: 12px;
    color: #4a3728;
    margin-bottom: 4px;
    text-align: center;
}

.pers-stats-column .block-divider {
    text-align: center;
    margin-bottom: 6px;
    line-height: 0;
}

.pers-stats-column .block-divider img {
    width: 100%;
    max-width: 200px;
    height: 3px;
    opacity: 0.6;
}

/* Currencies table */
.pers-stats-column .stats-currency-table {
    width: 100%;
    border-collapse: collapse;
}

.pers-stats-column .stats-currency-table td {
    padding: 3px 4px;
    vertical-align: middle;
}

.pers-stats-column .stats-currency-table td:first-child {
    width: 20px;
    text-align: center;
}

.pers-stats-column .stats-currency-table img {
    display: block;
    width: 15px;
    height: 15px;
}

.pers-stats-column .stats-currency-table a,
.pers-stats-column .stats-currency-table span {
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #4a3728;
    line-height: 16px;
    white-space: nowrap;
    text-decoration: none;
}

.pers-stats-column .stats-currency-table a:hover {
    color: #8b6914;
    text-decoration: underline;
}

/* Stats parameters table */
.pers-stats-column .stats-parameters-table {
    width: 100%;
    border-collapse: collapse;
}

.pers-stats-column .stats-parameters-table td {
    padding: 4px 2px;
    border-bottom: 1px solid rgba(180, 160, 120, 0.3);
    vertical-align: middle;
}

.pers-stats-column .stats-parameters-table tr:last-child td {
    border-bottom: none;
}

.pers-stats-column .stats-parameters-table td:first-child {
    width: 28px;
}

.pers-stats-column .stats-parameters-table td:first-child img {
    width: 24px;
    height: 23px;
    vertical-align: middle;
}

.pers-stats-column .stats-parameters-table td:nth-child(2) {
    font-weight: bold;
    font-size: 11px;
    color: #4a3728;
}

.pers-stats-column .stats-parameters-table td:nth-child(3) {
    text-align: left;
    white-space: nowrap;
    font-weight: bold;
    font-size: 12px;
    color: #333;
}

/* Shared gold stat badge (used by processStat, pluses, renderStatsCard) */
.stat-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #d5b36a 0%, #b8892f 100%);
    margin-left: 5px;
    font-size: 11px;
    font-weight: bold;
    vertical-align: middle;
    color: #1f262f;
}

.pers-stats-column .stat-bonus-details {
    font-size: 10px;
    color: #8a7a6a;
    font-weight: normal;
    white-space: nowrap;
    vertical-align: middle;
}

/* Modifiers: two-column layout */
.pers-stats-column .stats-modifiers-grid {
    display: flex;
    margin-top: 4px;
}

.pers-stats-column .stats-modifiers-names {
    width: 55%;
    text-align: left;
    font-weight: bold;
    font-size: 10px;
    color: #4a3728;
}

.pers-stats-column .stats-modifiers-values {
    width: 45%;
    text-align: center;
    font-weight: bold;
    font-size: 10px;
    color: #333;
}

.pers-stats-column .stats-modifiers-names div,
.pers-stats-column .stats-modifiers-values div {
    padding: 5px 4px;
    border-bottom: 1px solid rgba(180, 160, 120, 0.3);
}

.pers-stats-column .stats-modifiers-names div:last-child,
.pers-stats-column .stats-modifiers-values div:last-child {
    border-bottom: none;
}

/* SAVEstats & ups inside pers-stats */
.pers-stats-column #ups {
    text-align: center;
    padding: 4px 0;
}

.pers-stats-column #SAVEstats {
    text-align: center;
    padding: 4px 0;
}

.pers-doll-column {
    text-align: center;
    align-self: start;
    background: linear-gradient(180deg, #e8dfc8 0%, #d4c8a8 100%);
    border: 1px solid rgba(180, 160, 120, 0.6);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 8px 4px;
}

.pers-doll-column > table,
.pers-doll-column > div {
    margin-left: auto;
    margin-right: auto;
}

/* Character header: nick + HP/MP background */
.pers-doll-column .character-battle-header {
    width: 239px;
    max-width: 100%;
    margin: 0 auto;
    padding: 1px 0 0;
    background: #111111;
    border: 1px solid rgba(205, 195, 162, 0.45);
    border-radius: 2px;
}

.pers-doll-column .character-name-level.character-battle-name-row {
    margin: 0 auto;
    padding: 1px 4px;
    min-height: 18px;
    border: 1px solid rgba(214, 220, 228, 0.68);
    border-radius: 0;
    background: rgba(163, 171, 179, 0.35);
    line-height: 1;
    font-family: "Copperplate", "Times New Roman", serif;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}

.pers-doll-column .character-battle-name-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Nick font — Copperplate like info/battle */
.pers-doll-column .character-battle-name-row .Luser {
    font-family: "Copperplate", "Times New Roman", serif;
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

/* HP/MP fonts — Copperplate like info/battle */
.pers-doll-column .character-battle-header,
.pers-doll-column .character-battle-header * {
    font-family: "Copperplate", "Times New Roman", serif;
}

.pers-doll-column .character-battle-header b {
    font-weight: bold;
}

.pers-doll-column #chp,
.pers-doll-column #cma {
    font-family: "Copperplate", "Times New Roman", serif !important;
    font-size: 11px !important;
}

/* Doll frame — same as info page .character-doll-frame */
.pers-doll-column .pers-doll-frame {
    position: relative;
    width: 239px;
    margin: 0 auto;
}

.pers-doll-column .character-doll-column {
    position: absolute;
    top: 0;
    width: 39px;
    height: 385px;
    z-index: 1;
    pointer-events: none;
    user-select: none;
}

.pers-doll-column .character-doll-column-left {
    left: -35px;
}

.pers-doll-column .character-doll-column-right {
    right: -35px;
}

/* Bottom decoration line */
.pers-doll-column .character-doll-bottom-line {
    width: 239px;
    height: 16px;
    margin: 0 auto;
}

/* Aura block styling */
.pers-doll-column .aurasc {
    display: block;
    width: 239px;
    min-height: 36px;
    margin: 0 auto;
    padding: 8px 0 10px;
    text-align: center;
    box-sizing: border-box;
    border: 1px solid rgba(152, 160, 178, 0.5);
    border-top: none;
    border-radius: 0 0 12px 12px;
}

.pers-content-column {
    text-align: left;
    height: 100%;
}

.pers-content-column > .pers-content-inner {
    height: 100%;
}

.pers-content-column .pers-content-scroll {
    overflow-y: auto;
    min-height: 460px;
}

/* Mobile: single column */
@media (max-width: 1024px) {
    .pers-3col-grid {
        grid-template-columns: 1fr;
    }
    .topbar-main-cell {
        padding-left: 10px !important;
    }
}

/* Landscape-only: rotate prompt for portrait orientation */
.landscape-rotate-prompt {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999999;
    background: linear-gradient(140deg, #101820 0%, #1e3040 52%, #2a4a3a 100%);
    color: #e8e0d4;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    gap: 20px;
}

.landscape-rotate-prompt .rotate-icon {
    font-size: 64px;
    animation: rotate-phone 2s ease-in-out infinite;
}

.landscape-rotate-prompt .rotate-text {
    font-size: 18px;
    font-weight: bold;
    max-width: 280px;
    line-height: 1.5;
}

@keyframes rotate-phone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    75% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (max-width: 900px) {
    .landscape-rotate-prompt {
        display: flex;
    }
}
