/* ============================================================
   MYTIN — Modernes UI: Glassmorphism, Gold-Akzente, K-MMO-Vibe
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; user-select: none; }
:root {
  --gold: #e9c464;
  --gold2: #b98a2e;
  --cyan: #57e6ff;
  --red: #ff5f5f;
  --green: #6fe08a;
  --ink: #eef0f4;
  --dim: #98a0ae;
  --glass: rgba(13, 16, 24, 0.72);
  --glass2: rgba(20, 25, 36, 0.6);
  --line: rgba(255, 255, 255, 0.09);
  --r: 16px;
}
html, body { height: 100%; overflow: hidden; }
body {
  background: #07080c;
  color: var(--ink);
  font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  font-size: 15px;
}
button { font-family: inherit; cursor: pointer; color: inherit; background: none; border: none; }
b { font-weight: 700; }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.ok { color: var(--green); }
.bad { color: var(--red); }
.sm2 { font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: block; width: 100%;
  margin-top: 14px; padding: 13px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f4d98c, #cfa14a 55%, #a87c2c);
  color: #241a06; font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
  box-shadow: 0 6px 22px rgba(233, 196, 100, 0.28), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(233, 196, 100, 0.36); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  display: inline-block; margin-top: 16px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line);
  color: var(--dim); font-size: 13px;
}
.btn-ghost.danger { border-color: rgba(255, 95, 95, 0.3); color: #ff8a8a; }
.chip {
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  transition: background 0.12s;
  white-space: nowrap;
}
.chip:hover { background: rgba(255, 255, 255, 0.15); }
.chip.gold {
  background: linear-gradient(135deg, rgba(233, 196, 100, 0.22), rgba(185, 138, 46, 0.16));
  border-color: rgba(233, 196, 100, 0.45);
  color: var(--gold);
}
.badge {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; padding: 1px 7px; vertical-align: 2px;
}

/* ============================================================
   Charaktererstellung
   ============================================================ */
#create {
  position: fixed; inset: 0; z-index: 40;
  background: url('assets/bg/bg_login.jpg') center / cover;
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; padding: 4vh 16px 40px;
}
#create::before {
  content: ''; position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(7,8,12,0.25), rgba(7,8,12,0.94) 78%);
}
#create-inner { position: relative; width: min(560px, 100%); text-align: center; }
.cr-logo { width: min(360px, 74vw); filter: drop-shadow(0 10px 30px rgba(0,0,0,0.9)); margin-bottom: 10px; }
.cr-card {
  background: var(--glass);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 24px 22px; text-align: left;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.cr-head { font-size: 19px; font-weight: 800; letter-spacing: 0.04em; text-align: center; margin-bottom: 16px; }
.cr-input {
  width: 100%; padding: 13px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font-size: 16px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.cr-input:focus { border-color: var(--gold); }
.cr-label { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.cr-realms { display: flex; gap: 8px; }
.realm-pill {
  flex: 1; padding: 10px; border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink); font-weight: 700; font-size: 14px;
  transition: all 0.15s;
}
.realm-pill.sel {
  border-color: var(--rc); color: var(--rc);
  background: color-mix(in srgb, var(--rc) 14%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--rc) 30%, transparent);
}
.cr-realmdesc { margin-top: 8px; font-size: 13px; color: var(--dim); min-height: 34px; }
.cr-classes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cc-card {
  border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 4px 8px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.cc-card img { width: 100%; height: 84px; object-fit: contain; transition: transform 0.2s; }
.cc-card span { display: block; font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.cc-card.sel {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(233, 196, 100, 0.12), rgba(233, 196, 100, 0.04));
  box-shadow: 0 0 22px rgba(233, 196, 100, 0.22);
}
.cc-card.sel img { transform: scale(1.1); }
.cr-clsdesc { margin-top: 12px; font-size: 13.5px; line-height: 1.5; min-height: 56px; }
.cr-controls { position: relative; margin-top: 16px; font-size: 12px; }

/* ============================================================
   Spiel: Canvas + HUD
   ============================================================ */
#world { position: fixed; inset: 0; display: block; background: #07080c; }

/* Spieler-Plate oben links */
#plate {
  position: fixed; top: 14px; left: 14px; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 9px 18px 9px 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.avatar-ring {
  position: relative; width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #7a5a1d);
  padding: 2px;
}
.avatar-ring img {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; object-position: top; background: #10131c;
}
#hud-lvl {
  position: absolute; bottom: -3px; right: -3px;
  background: linear-gradient(135deg, #f4d98c, #b98a2e);
  color: #241a06; font-size: 11px; font-weight: 900;
  min-width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 999px; padding: 0 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
#hud-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
#hud-sub { font-size: 11.5px; color: var(--dim); margin-bottom: 5px; }
.hpbar {
  position: relative; width: 190px; height: 14px;
  background: rgba(0, 0, 0, 0.55); border-radius: 999px;
  border: 1px solid var(--line); overflow: hidden;
}
.hpbar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ff7360, #d92f3c);
  border-radius: 999px;
  transition: width 0.25s;
  box-shadow: 0 0 12px rgba(255, 80, 70, 0.5);
}
.hpbar span {
  position: absolute; inset: 0; text-align: center;
  font-size: 9.5px; font-weight: 700; line-height: 14px; color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* Yang + Menü oben rechts */
#topright { position: fixed; top: 14px; right: 14px; z-index: 10; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.tr-row { display: flex; gap: 8px; align-items: center; }
.yang-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-weight: 800; color: var(--gold); font-size: 14.5px;
}
.icon-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, transform 0.12s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.icon-btn.notify::after {
  content: ''; position: absolute; top: 6px; right: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 8px var(--red);
}
#minimap {
  width: 168px; height: 112px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--glass);
}
#tracker {
  width: 168px;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px;
}
.tr-title { font-size: 12.5px; font-weight: 800; color: var(--gold); }
.tr-desc { font-size: 11px; color: var(--dim); margin: 3px 0 6px; line-height: 1.35; }
.tr-bar { height: 5px; background: rgba(0,0,0,0.5); border-radius: 999px; overflow: hidden; }
.tr-bar.big { height: 10px; margin: 10px 0 6px; }
.tr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f4d98c, #b98a2e); border-radius: 999px; transition: width 0.3s; }
.tr-n { font-size: 10.5px; color: var(--dim); text-align: right; margin-top: 3px; }

/* XP-Leiste unten */
#xpwrap {
  position: fixed; left: 0; right: 0; bottom: 0; height: 5px; z-index: 10;
  background: rgba(255, 255, 255, 0.05);
}
#xpbar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #57a6ff, #8f6bff);
  box-shadow: 0 0 10px rgba(110, 130, 255, 0.6);
  transition: width 0.4s;
}

/* Action-Bar unten rechts */
#actions {
  position: fixed; right: 18px; bottom: 26px; z-index: 10;
  display: flex; align-items: flex-end; gap: 12px;
}
.act-btn {
  position: relative;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--line);
  font-size: 25px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s, border-color 0.15s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.act-btn:active { transform: scale(0.92); }
.act-btn .key {
  position: absolute; top: -7px; right: -2px;
  background: rgba(255,255,255,0.14); border: 1px solid var(--line);
  color: var(--dim); font-size: 9.5px; font-weight: 800;
  border-radius: 6px; padding: 1px 5px;
}
.act-btn .cnt {
  position: absolute; bottom: -4px; right: -4px;
  background: var(--gold); color: #241a06;
  font-size: 11px; font-weight: 900;
  min-width: 20px; height: 20px; line-height: 20px; border-radius: 999px;
}
#btn-atk {
  width: 76px; height: 76px; font-size: 31px;
  border-color: rgba(233, 196, 100, 0.5);
  background: linear-gradient(160deg, rgba(233, 196, 100, 0.2), rgba(13,16,24,0.75));
}
#btn-skill.oncd::before {
  content: ''; position: absolute; inset: -1.5px;
  border-radius: 50%;
  background: conic-gradient(rgba(0,0,0,0.72) var(--cd), transparent 0);
}
#btn-int { display: none; border-color: rgba(87, 230, 255, 0.55); }
#btn-int.vis { display: flex; animation: pop 0.18s ease; }
#int-label {
  position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11.5px; font-weight: 700; color: var(--cyan);
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 11px;
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

/* Joystick (Touch) */
#joy {
  position: fixed; left: 22px; bottom: 30px; z-index: 10;
  width: 124px; height: 124px; border-radius: 50%;
  background: rgba(13, 16, 24, 0.45);
  border: 1.5px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none;
}
#joyknob {
  position: absolute; left: 50%; top: 50%; margin: -26px 0 0 -26px;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
@media (pointer: coarse) {
  #joy { display: block; }
  .act-btn .key { display: none; }
}
body.touch #joy { display: block; }
body.touch .act-btn .key { display: none; }

/* Karten-Banner */
#mapbanner {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  z-index: 9; text-align: center; pointer-events: none;
  opacity: 0;
}
#mapbanner.show { animation: banner 3.4s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  12%, 78% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; }
}
.mb-t {
  font-size: 30px; font-weight: 900; letter-spacing: 0.16em; color: #fff;
  text-shadow: 0 2px 24px rgba(233, 196, 100, 0.65), 0 2px 6px #000;
}
.mb-s { font-size: 13px; color: var(--gold); letter-spacing: 0.28em; text-transform: uppercase; margin-top: 4px; text-shadow: 0 1px 4px #000; }

/* Treffer-Flash + Tod + Fade */
#hitflash { position: fixed; inset: 0; z-index: 8; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px rgba(255, 40, 40, 0.55); }
#hitflash.on { animation: hf 0.35s ease; }
@keyframes hf { 0% { opacity: 1; } 100% { opacity: 0; } }
#death {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.45), rgba(5, 0, 0, 0.88));
  opacity: 0; transition: opacity 0.6s;
  display: flex; align-items: center; justify-content: center;
}
#death.on { opacity: 1; }
#death span { font-size: 42px; font-weight: 900; letter-spacing: 0.3em; color: #ff6a6a; text-shadow: 0 0 40px rgba(255,0,0,0.6); }
#fade { position: fixed; inset: 0; z-index: 30; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.35s; }
#fade.on { opacity: 1; pointer-events: all; }

/* Toasts */
#toasts {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  z-index: 25; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(430px, 92vw);
}
.toast {
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 14px; padding: 11px 18px;
  font-size: 13.5px; line-height: 1.45; text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(-10px) scale(0.97);
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  max-width: 100%;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }

/* ============================================================
   Fenster
   ============================================================ */
#winwrap {
  position: fixed; inset: 0; z-index: 22;
  background: rgba(4, 5, 8, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
#win {
  width: min(520px, 100%); max-height: min(680px, 92vh);
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  animation: winin 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes winin { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.win-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
#win-title { font-size: 17px; font-weight: 800; letter-spacing: 0.02em; }
.win-x {
  width: 32px; height: 32px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line);
  font-size: 15px; color: var(--dim);
}
#win-tabs { display: flex; gap: 6px; padding: 12px 20px 0; flex-wrap: wrap; }
#win-tabs:empty { padding: 0; }
.tab {
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--dim);
  background: rgba(255, 255, 255, 0.05); border: 1px solid transparent;
}
.tab.on { color: var(--gold); border-color: rgba(233, 196, 100, 0.4); background: rgba(233, 196, 100, 0.1); }
#win-body { padding: 14px 20px 20px; overflow-y: auto; }
#win-body::-webkit-scrollbar { width: 6px; }
#win-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.sect {
  margin: 16px 0 6px; font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim);
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}
.row.sm { padding: 7px 0; font-size: 13.5px; }
.row .rl { width: 44px; font-weight: 700; color: var(--gold); flex: 0 0 auto; }
.rbtns { display: flex; gap: 6px; flex: 0 0 auto; }
.merow { background: rgba(233, 196, 100, 0.08); border-radius: 8px; padding: 7px 8px !important; border: 1px solid rgba(233, 196, 100, 0.25); }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statcard {
  background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 1px;
}
.statcard span { font-size: 11px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; }
.statcard b { font-size: 17px; }
.skillrow, .smithrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sk-info { flex: 1; font-size: 14px; line-height: 1.4; }
.hint {
  margin: 12px 0 4px; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line);
  border-radius: 12px; font-size: 13px; line-height: 1.5;
}
.npc-head { display: flex; gap: 14px; align-items: center; font-size: 13.5px; line-height: 1.5; margin-bottom: 6px; }
.npc-head img { height: 92px; flex: 0 0 auto; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6)); }

/* Mobile Anpassungen */
@media (max-width: 640px) {
  #plate { padding: 7px 12px 7px 7px; top: 10px; left: 10px; }
  .hpbar { width: 138px; }
  #minimap, #tracker { width: 138px; }
  #minimap { height: 92px; }
  #topright { gap: 8px; top: 84px; right: 10px; }
  #mapbanner { top: 150px; }
  #toasts { top: 150px; }
  .mb-t { font-size: 22px; }
  #actions { right: 14px; bottom: 26px; gap: 9px; }
  .act-btn { width: 56px; height: 56px; font-size: 22px; }
  #btn-atk { width: 70px; height: 70px; font-size: 28px; }
  .cr-classes { grid-template-columns: repeat(5, 1fr); }
  .cc-card img { height: 58px; }
}
