* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #050608;
  font-family: Tahoma, Arial, sans-serif;
  color: #f0e6d2;
  touch-action: none;
}
#game-root {
  position: relative; width: 100vw; height: 100vh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #050608;
}
#canvas {
  display: block;
  width: 100%; height: 100%;
  outline: none;
  background: #000;
  cursor: url('/cursors/Cursor_Normal.cur'), auto;
}
#canvas.fixed-res {
  box-shadow: 0 0 0 1px rgba(130, 124, 118, 0.45), 0 12px 42px rgba(0, 0, 0, 0.9);
}
.hidden { display: none !important; }

/* =========================================================================
 * Authentic v1453 Fire Drake Launcher (700x430 exact layout from Usko docs)
 * ========================================================================= */
#loader-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, #1b110d 0%, #050507 78%);
}
#launcher-v1453 {
  position: relative;
  width: 700px; height: 430px;
  max-width: 96vw;
  background: url('/launcher/bg_1453.png') center/100% 100% no-repeat;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.92), 0 0 0 1px rgba(150, 42, 42, 0.45);
  transform-origin: center center;
}
#launcher-btn-close {
  position: absolute; left: 658px; top: 13px; width: 29px; height: 24px;
  border: none; cursor: pointer;
  background: url('/launcher/btn_close_normal.png') center/100% 100% no-repeat;
}
#launcher-btn-close:hover { background-image: url('/launcher/btn_close_hover.png'); }
#launcher-btn-close:active { background-image: url('/launcher/btn_close_down.png'); }

#launcher-status-bar {
  position: absolute; left: 294px; top: 312px; width: 374px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: #f6e7c8; text-shadow: 1px 1px 2px #000;
  padding: 0 2px;
}
#launcher-version { color: #e8c37a; font-weight: 700; }

#launcher-prog-track {
  position: absolute; left: 294px; top: 332px; width: 374px; height: 16px;
  background: url('/launcher/prog_bg.png') left top/374px 16px no-repeat;
  overflow: hidden;
}
#loader-bar {
  width: 0%; height: 16px;
  background: url('/launcher/prog_fill.png') left top/374px 16px no-repeat;
  transition: width 0.14s ease-out;
}

.l1453-btn {
  position: absolute; top: 366px; width: 119px; height: 28px;
  border: none; cursor: pointer; background-size: 100% 100%; background-repeat: no-repeat;
}
#launcher-btn-start { left: 293px; background-image: url('/launcher/btn_start_normal.png'); }
#launcher-btn-start:hover:not(:disabled) { background-image: url('/launcher/btn_start_hover.png'); }
#launcher-btn-start:active:not(:disabled) { background-image: url('/launcher/btn_start_down.png'); }
#launcher-btn-start:disabled { background-image: url('/launcher/btn_start_disabled.png'); cursor: wait; opacity: 0.92; }

#launcher-btn-home { left: 423px; background-image: url('/launcher/btn_homepage_normal.png'); }
#launcher-btn-home:hover { background-image: url('/launcher/btn_homepage_hover.png'); }
#launcher-btn-home:active { background-image: url('/launcher/btn_homepage_down.png'); }

#launcher-btn-option { left: 553px; background-image: url('/launcher/btn_option_normal.png'); }
#launcher-btn-option:hover { background-image: url('/launcher/btn_option_hover.png'); }
#launcher-btn-option:active { background-image: url('/launcher/btn_option_down.png'); }

/* =========================================================================
 * Blender-Rendered Pale Beveled Carved-Stone 1298 Modal & Buttons
 * (Matches Character Report / Quest / Clan / Friend & Skill K menus)
 * ========================================================================= */
.stone-btn {
  min-width: 96px; height: 28px; padding: 0 12px;
  border: none; cursor: pointer; background-color: transparent;
  background: url('/ui/stone_btn_normal.png') center/100% 100% no-repeat;
  color: #161412; font-family: Tahoma, Arial, sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.15px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.stone-btn:hover {
  background-image: url('/ui/stone_btn_hover.png');
  color: #090807;
}
.stone-btn:active {
  background-image: url('/ui/stone_btn_active.png');
  color: #fff2e8;
  text-shadow: 1px 1px 1px #000;
  transform: translateY(1px);
}
.stone-btn-wide { min-width: 152px; height: 32px; font-size: 12.5px; }

/* Carved Stone In-Game Options Modal */
#options-modal {
  position: absolute; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.68);
}
.options-card {
  width: min(440px, 94vw);
  padding: 20px 24px 20px 24px;
  background: url('/ui/stone_panel.png') center/100% 100% no-repeat;
  filter: drop-shadow(0 14px 36px rgba(0,0,0,0.9));
}
.options-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 4px 12px 4px; margin-bottom: 10px;
  font-size: 13.5px; font-weight: 700; color: #ece7df;
  text-shadow: 1px 1px 2px #000;
}
.stone-close-btn {
  width: 28px; height: 28px; border: none; cursor: pointer;
  background: url('/ui/stone_close.png') center/100% 100% no-repeat;
}
.stone-close-btn:hover { filter: brightness(1.18); }
.stone-close-btn:active { transform: translateY(1px); }

.options-body {
  padding: 6px 4px 10px 4px;
  display: flex; flex-direction: column; gap: 9px;
}
.opt-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: #e8e4de; text-shadow: 1px 1px 1px #000;
  gap: 10px; padding: 4px 8px;
  background: rgba(14, 13, 12, 0.56);
  border: 1px solid rgba(155, 149, 142, 0.32);
}
.opt-select {
  background: #22201e; color: #f0ece6;
  border: 1px solid #8a847d; border-radius: 2px;
  padding: 3px 6px; font-size: 12px; font-family: Tahoma, Arial, sans-serif;
  cursor: pointer; max-width: 225px;
}
.opt-row input[type="checkbox"] { accent-color: #b5afa8; width: 16px; height: 16px; cursor: pointer; }
.opt-row input[type="range"] { accent-color: #c7c1ba; width: 130px; cursor: pointer; }
.options-footer { padding-top: 8px; text-align: right; }

/* Portrait Orientation Guard */
#portrait-guard {
  position: absolute; inset: 0; z-index: 65;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 7, 6, 0.95); text-align: center; padding: 24px;
}
.portrait-icon { font-size: 48px; margin-bottom: 12px; }
.portrait-box h2 { color: #f4d380; margin-bottom: 8px; }
.portrait-box p { color: #cbbba0; margin-bottom: 16px; font-size: 14px; }

/* On-demand Mobile Login/CharSelect Keyboard Bar */
#mobile-login-kb {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; gap: 5px; align-items: center;
  padding: 5px 8px;
  background: rgba(16, 14, 12, 0.92);
  border: 1px solid #9e7b38; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8);
  pointer-events: auto; max-width: 94vw;
}
#mobile-login-input {
  width: 175px; padding: 5px 8px;
  border: 1px solid #9e7b38; background: rgba(10, 9, 8, 0.95);
  color: #fff; font-size: 13px; user-select: text; -webkit-user-select: text;
}

/* Mobile Touch Controls (Carved Stone & Gold Palette) */
#mobile-hud { position: absolute; inset: 0; z-index: 25; pointer-events: none; }
#mobile-top-strip {
  position: absolute; top: 6px; left: 260px; right: 215px;
  display: flex; gap: 5px; align-items: center; justify-content: center;
  pointer-events: auto; overflow-x: auto;
}
#mobile-chat-input {
  width: 170px; padding: 5px 8px;
  border: 1px solid #9e7b38; background: rgba(16, 14, 12, 0.88);
  color: #fff; font-size: 12px; user-select: text; -webkit-user-select: text;
}
.m-chip {
  min-width: 58px; height: 26px; padding: 0 8px; border: none; cursor: pointer;
  background: url('/ui/stone_btn_normal.png') center/100% 100% no-repeat;
  font-size: 11px; font-weight: 700; color: #161412;
  text-shadow: 0 1px 0 rgba(255,255,255,0.42); white-space: nowrap;
}
.m-chip:active { background-image: url('/ui/stone_btn_active.png'); color: #fff; text-shadow: 1px 1px 1px #000; }

#joystick-zone {
  position: absolute; left: 18px; bottom: 18px;
  width: 136px; height: 136px; pointer-events: auto;
}
#joystick-base {
  width: 128px; height: 128px; border-radius: 50%;
  border: 2px solid #b68d40;
  background: radial-gradient(circle, rgba(46, 42, 38, 0.58), rgba(18, 16, 14, 0.72));
  box-shadow: inset 0 0 14px rgba(0,0,0,0.85);
  position: relative;
}
#joystick-knob {
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e5be6a, #7d591e 70%, #3a2910);
  border: 2px solid #f7dfa0;
  position: absolute; left: 35px; top: 35px;
}

#skill-cluster {
  position: absolute; right: 14px; bottom: 14px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: auto;
}
#fbar-strip { display: flex; gap: 3px; }
.fbar-btn {
  width: 28px; height: 22px; border: none; cursor: pointer;
  background: url('/ui/stone_btn_normal.png') center/100% 100% no-repeat;
  font-size: 10.5px; font-weight: 700; color: #181614; text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.fbar-btn.active { background-image: url('/ui/stone_btn_active.png'); color: #fff5ee; text-shadow: 1px 1px 1px #000; }

#skill-arc { position: relative; width: 220px; height: 170px; }
.sk-btn {
  position: absolute; border-radius: 50%;
  font-weight: 700; color: #f6e4b8; text-shadow: 1px 1px 2px #000;
  background: radial-gradient(circle at 35% 30%, #4c463f, #221f1c 75%);
  border: 2px solid #c29642;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.75), 0 3px 8px rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
}
.sk-btn:active { background: radial-gradient(circle, #916923, #4a330e); transform: scale(0.94); }
.sk-main { width: 62px; height: 62px; right: 4px; bottom: 4px; font-size: 18px; border-color: #f0a444; background: radial-gradient(circle at 35% 30%, #7d2c1b, #36100a); }
.sk-sec  { width: 46px; height: 46px; right: 76px; bottom: 6px; font-size: 14px; border-color: #7cc6f5; }
.sk-num  { width: 42px; height: 42px; font-size: 14px; }
.sk-num[data-slot="1"] { right: 132px; bottom: 8px; }
.sk-num[data-slot="2"] { right: 168px; bottom: 52px; }
.sk-num[data-slot="3"] { right: 158px; bottom: 102px; }
.sk-num[data-slot="4"] { right: 114px; bottom: 126px; }
.sk-num[data-slot="5"] { right: 64px;  bottom: 122px; }
.sk-num[data-slot="6"] { right: 14px;  bottom: 108px; }
.sk-num[data-slot="7"] { right: 74px;  bottom: 62px; }
.sk-num[data-slot="8"] { right: 120px; bottom: 62px; }

#toast-msg {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 70; padding: 8px 18px;
  background: url('/ui/stone_btn_normal.png') center/100% 100% no-repeat;
  color: #161412; font-size: 12.5px; font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.opt-perf-row { font-size: 12px; color: #d8c49a; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 8px; margin-top: 4px; }
