@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

@font-face {
  font-family: "NEXON Warhaven";
  src: url("../assets/font/NEXON_Warhaven_OTF_Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NEXON Warhaven";
  src: url("../assets/font/NEXON_Warhaven_OTF_Bold.otf") format("opentype");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --cursor-arcane: url("../assets/ui/cursor-sword.svg") 2 2, auto;
  --cursor-arcane-pointer: url("../assets/ui/cursor-sword-pointer.svg") 2 2, pointer;
}

body {
  background: #fff;
  overflow: hidden;
  font-family: "Pretendard", "Segoe UI", sans-serif;
  font-weight: 400;
  user-select: none;
  touch-action: none;
  cursor: var(--cursor-arcane);
}

#game {
  display: block;
  position: relative;
  z-index: 1;
  background: transparent;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  cursor: var(--cursor-arcane);
}

#pixi-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

#ui {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 10;
}

body:not(.playing) #ui,
body:not(.playing) #party-ui,
body:not(.playing) #skill-ui,
body:not(.playing) #potion-slot,
body:not(.playing) #time-scale-toggle,
body:not(.playing) #mute-toggle,
body:not(.playing) #bottom-bars,
body:not(.playing) #artifact-list,
body:not(.playing) #info-overlay {
  display: none;
}

#stats {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  width: auto;
  min-height: 0;
  padding: 0;
  background: none;
  color: rgba(255, 255, 255, 0.94);
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
  white-space: nowrap;
}

#stats strong {
  color: #ffe88a;
  font-weight: 700;
}

#perf-stats {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  margin: 0;
  padding: 0;
  width: auto;
  max-width: none;
  background: transparent;
  color: #fff;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  white-space: pre;
  pointer-events: none;
  z-index: 60;
}

body.perf-visible #perf-stats {
  display: block;
}

#artifact-list {
  position: fixed;
  left: 16px;
  top: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 2px 0;
  overflow: visible;
  transform: translateY(-50%);
  pointer-events: none;
}

#artifact-list .artifact-badge {
  pointer-events: auto;
}

#artifact-list.empty {
  display: none;
}

.artifact-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(22, 18, 28, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.artifact-badge img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.artifact-badge span {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: rgba(143, 43, 32, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

#party-ui {
  position: fixed;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  z-index: 10;
}

#party-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.party-member {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: visible;
  background: #17141d;
  border: 2px solid var(--member-stroke);
  border-radius: 50%;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  color: #fff;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  opacity: 0.76;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.party-member.active {
  transform: translateY(-3px);
  border-color: var(--member-color);
  box-shadow: 0 0 0 2px var(--member-stroke), 0 7px 20px rgba(0, 0, 0, 0.24);
  opacity: 1;
}

.party-member.support {
  opacity: 0.9;
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.35), 0 4px 14px rgba(0, 0, 0, 0.16);
}

.party-member-ult-ready {
  position: absolute;
  top: 50%;
  right: -7px;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(8, 25, 14, 0.95);
  border-radius: 50%;
  background: #3cff7a;
  box-shadow: 0 0 8px rgba(60, 255, 122, 0.9), 0 0 2px rgba(255, 255, 255, 0.9) inset;
  opacity: 0;
  transform: translateY(-50%) scale(0.7);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}

.party-member.ult-ready .party-member-ult-ready {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.party-member.downed {
  opacity: 0.3;
  filter: grayscale(1);
  cursor: default;
  pointer-events: none;
}

.party-member.switch-cooldown {
  opacity: 0.48;
  filter: grayscale(0.35);
}

.party-member-switch-cooldown {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: rgba(9, 8, 14, 0.62);
  color: #fff4bf;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 207, 72, 0.55), 0 2px 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.party-member.switch-cooldown .party-member-switch-cooldown {
  display: grid;
}

.party-member-portrait {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 50%;
  background: #17141d;
}

.party-member-key {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
}

#skill-ui {
  position: fixed;
  right: 28px;
  bottom: 74px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 68px);
  align-items: end;
  gap: 12px;
}

#potion-slot {
  position: fixed;
  right: 362px;
  bottom: 74px;
  z-index: 10;
}

.potion-slot {
  display: grid;
  grid-template-rows: 68px 18px;
  justify-items: center;
  align-items: end;
  width: 68px;
  height: 88px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: var(--cursor-arcane-pointer);
  overflow: visible;
  position: fixed;
  color: #fff;
  font: inherit;
  text-align: center;
}

.potion-slot:hover:not(:disabled) {
  transform: translateY(-1px);
}

.potion-slot:disabled {
  cursor: default;
}

.potion-slot.empty {
  opacity: 0.42;
}

.potion-slot.on-cooldown {
  opacity: 0.72;
}

.potion-icon {
  width: 64px;
  height: 64px;
  padding: 12px;
  object-fit: contain;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  box-shadow: none;
  filter: brightness(10) saturate(0);
}

.potion-key {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.potion-count {
  position: absolute;
  right: 1px;
  top: 45px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: #8f2b20;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.potion-name {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.potion-cooldown {
  position: absolute;
  inset: 0 4px 20px 0;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
}

.potion-cooldown.visible {
  opacity: 1;
}

.skill-slot {
  position: relative;
  display: grid;
  grid-template-rows: 68px 18px;
  justify-items: center;
  align-items: end;
  width: 68px;
  height: 88px;
  min-height: 0;
  padding: 0;
  gap: 2px;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  text-align: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.skill-slot:hover:not(.on-cooldown) {
  transform: translateY(-1px);
}

.skill-slot::after {
  content: attr(data-skill-level);
  position: absolute;
  right: 0;
  top: 47px;
  min-width: 24px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(143, 43, 32, 0.92);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
}

.skill-slot.locked::after {
  display: none;
}

.skill-key {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
}

.skill-icon {
  width: 64px;
  height: 64px;
  padding: 13px;
  object-fit: contain;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  box-shadow: none;
  filter: brightness(10) saturate(0);
  pointer-events: none;
}

.skill-meta {
  display: none;
}

.skill-name {
  width: 100%;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  word-break: keep-all;
}

.skill-slot--ult {
  color: #fff;
}

.skill-slot--ult .skill-icon {
  background: transparent;
  border: 1px solid rgba(210, 170, 255, 0.65);
  box-shadow: none;
  filter: brightness(10) saturate(0);
}

.skill-slot--ult .skill-name {
  color: #fff;
}

.skill-slot--ult.on-cooldown {
  opacity: 0.62;
}

.skill-slot.locked {
  opacity: 0.52;
}

.skill-key--ult {
  background: rgba(80, 25, 145, 0.9);
  box-shadow: 0 0 10px rgba(160, 80, 255, 0.6);
  color: #fff;
}

.skill-cooldown {
  position: absolute;
  inset: 0 4px 20px 0;
  width: 64px;
  height: 64px;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.skill-cooldown.visible {
  opacity: 1;
}

.skill-slot.locked .skill-cooldown {
  background: rgba(24, 18, 12, 0.66);
  font-size: 14px;
}

#bottom-bars {
  position: fixed;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 10;
  display: block;
  width: auto;
  height: 18px;
  padding: 0;
  background: rgba(14, 11, 8, 0.68);
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.32);
}

#hp-bar-ui {
  display: none;
}

#xp-bar-ui {
  position: relative;
  height: 100%;
}

.bottom-bar-top {
  position: absolute;
  inset: 0 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: rgba(255, 246, 211, 0.92);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0;
  text-shadow: none;
  pointer-events: none;
}

.bottom-bar-top strong {
  color: #fff2a6;
  font-weight: 700;
}

.bottom-bar-track {
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0;
}

#hp-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e74c3c, #c0392b);
  border-radius: inherit;
  transition: width 0.12s ease;
}

#xp-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #d9a724 0%, #f1c84a 52%, #fff0a8 100%);
  border-radius: inherit;
  transition: width 0.16s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 0 10px rgba(241, 196, 15, 0.34);
}

#xp-bar-ui.paragon-active .bottom-bar-top strong {
  color: #8bd8ff;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.62);
}

#xp-bar-ui.paragon-active #xp-bar-fill {
  background: linear-gradient(90deg, #075985 0%, #0284c7 52%, #7dd3fc 100%);
  box-shadow: inset 0 1px 0 rgba(224, 242, 254, 0.36), 0 0 12px rgba(14, 165, 233, 0.46);
}

.hud-icon-button {
  position: fixed;
  left: 18px;
  bottom: 42px;
  z-index: 12;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background:
    linear-gradient(145deg, rgba(255, 248, 219, 0.96), rgba(211, 169, 95, 0.82)),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.85), transparent 42%);
  border: 1px solid rgba(82, 49, 26, 0.58);
  border-radius: 50%;
  color: #5b3518;
  cursor: var(--cursor-arcane-pointer);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -4px 10px rgba(96, 55, 24, 0.2),
    0 6px 16px rgba(33, 20, 12, 0.28);
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease, filter 0.12s ease;
}

#mute-toggle {
  left: 74px;
}

.hud-icon-button.active {
  background:
    linear-gradient(145deg, rgba(141, 43, 35, 0.96), rgba(92, 35, 29, 0.92)),
    radial-gradient(circle at 30% 20%, rgba(255, 220, 150, 0.38), transparent 42%);
  border-color: rgba(255, 225, 145, 0.82);
  color: #fff1b6;
  filter: saturate(1.08);
}

.hud-icon-button:hover {
  border-color: rgba(192, 57, 43, 0.84);
  color: #c0392b;
  transform: translateY(-1px);
}

.hud-icon-button.active:hover {
  color: #fff4bf;
}

.hud-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#time-scale-toggle .hud-icon {
  fill: currentColor;
  stroke: none;
  transform: translateX(1px);
}

.hud-icon-badge {
  position: absolute;
  right: -6px;
  bottom: -5px;
  min-width: 26px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid rgba(80, 45, 24, 0.44);
  border-radius: 999px;
  background: rgba(255, 247, 219, 0.96);
  color: #6a3d1f;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 17px;
  box-shadow: 0 2px 7px rgba(34, 19, 11, 0.24);
  pointer-events: none;
}

.hud-icon-button.active .hud-icon-badge {
  background: rgba(255, 226, 143, 0.96);
  color: #7d241d;
}

.sound-off-icon,
#mute-toggle.active .sound-on-icon {
  display: none;
}

#mute-toggle.active .sound-off-icon {
  display: block;
}

#master-ui {
  position: fixed;
  left: 12px;
  bottom: 94px;
  z-index: 15;
  width: 280px;
  min-height: 158px;
  padding: 20px 24px 18px;
  background: #f4e7c8;
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(255, 242, 200, 0.92);
}

#master-ui.hidden {
  display: none;
}

#info-overlay {
  position: fixed;
  inset: 0;
  z-index: 17;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#info-overlay.hidden {
  display: none;
}

#info-panel {
  width: min(1120px, calc(100vw - 48px));
  min-height: min(550px, calc(100vh - 56px));
  padding: 56px 72px 60px;
  background: #f4e7c8;
  border: 1px solid rgba(200, 160, 80, 0.32);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(255, 242, 200, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.info-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.info-header h2 {
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  color: #f0d080;
  font-size: 30px;
  font-weight: 700;
}

#info-stage {
  color: #e8a060;
  font-size: 15px;
  font-weight: 700;
}

.info-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr 1fr 1.2fr;
  gap: 20px;
}

.info-section h3,
#info-upgrades h4 {
  margin-bottom: 12px;
  color: #f0d080;
  font-size: 17px;
  font-weight: 700;
}

.info-section dl {
  display: grid;
  gap: 8px;
}

.info-section dl div,
.info-skill-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 24px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(96, 76, 54, 0.18);
}

.info-section dt,
.info-skill-row span {
  color: #765f45;
  font-size: 13px;
  font-weight: 400;
}

.info-section dd,
.info-skill-row strong {
  color: #3f2a14;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

#info-skills {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

#info-upgrades ul {
  display: grid;
  gap: 6px;
  max-height: 172px;
  overflow-y: auto;
  padding-right: 4px;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 58, 23, 0.32) transparent;
}

#info-upgrades ul + h4 {
  margin-top: 14px;
}

#info-upgrades li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 21px;
  color: #604c36;
  font-size: 13px;
  font-weight: 400;
}

#info-upgrades li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#info-upgrades li strong {
  color: #e8a060;
}

#info-upgrades li.info-rune-effect {
  align-items: flex-start;
}

#info-upgrades li.info-rune-effect span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

#info-upgrades li.info-rune-effect b {
  color: #3f2a14;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

#info-upgrades li.info-rune-effect em {
  color: #725f45;
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.info-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.info-legend span {
  font-size: 12px;
  font-weight: 700;
}

.info-legend .elite {
  color: #2b78d0;
}

.info-legend .rare {
  color: #b78210;
}

.info-legend .boss {
  color: #c0392b;
}

.info-legend .epic-boss {
  color: #9933cc;
}

.info-legend .superepic-boss {
  color: #d4a017;
}

#start-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.28)),
    url("../assets/ui/start-background.png") center / cover no-repeat;
}

#start-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

#start-screen.hidden {
  display: none;
}

#start-screen.start-flow-party {
  background:
    linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.78)),
    url("../assets/ui/start-background.png") center / cover no-repeat;
}

#start-screen.start-flow-party::after {
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
}

#start-screen.start-flow-title {
  cursor: var(--cursor-arcane-pointer);
}

#start-screen.start-flow-party .start-credit,
#start-screen.start-flow-party .start-attribution {
  display: none;
}

.start-bg-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.start-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(980px, 96vw);
  max-width: 96vw;
  margin: 0 auto;
  text-align: center;
}

.start-step {
  display: none;
}

.start-step.start-step-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: start-reveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.start-step-heading {
  margin: 0 0 6px;
  color: #fff;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 22px;
  letter-spacing: 0.12em;
}

.start-step-desc {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.start-panel h1 {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  color: #fff;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 58px;
  font-weight: 700;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.start-title-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  animation: start-title-char-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.start-title-char:not(.start-title-space):not(:last-child) {
  margin-right: 0.12em;
}

.start-title-space {
  width: 0.35em;
}

@keyframes start-title-char-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.party-pick-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.party-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto 16px;
}

.party-select-status {
  margin: 0 0 12px;
  width: 100%;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-align: center;
}

.party-roster-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 0 10px;
}

.party-roster-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.party-pick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 calc((100% - 32px) / 5);
  width: calc((100% - 32px) / 5);
  max-width: 236px;
  min-width: 0;
  min-height: 288px;
  padding: 0;
  overflow: visible;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

.party-pick-card:hover:not(.disabled) {
  filter: brightness(1.05);
}

.party-pick-card.selected {
  filter: brightness(1.08);
}

.party-pick-card.sparkle-active .party-pick-illust {
  animation: party-sparkle-pulse 2.6s ease-in-out infinite;
}

.party-pick-card.sparkle-active .party-pick-sparkle {
  opacity: 1;
  animation: party-sparkle-spin 5s linear infinite;
}

.party-pick-card.disabled {
  opacity: 0.38;
  cursor: default;
  filter: grayscale(0.35);
}

.party-pick-illust {
  flex: 0 0 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 220px;
  padding: 0;
  overflow: visible;
}

.party-pick-illust-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
}

.party-pick-illust-frame img {
  display: block;
  height: 220px;
  width: auto;
  max-width: min(100%, 220px);
  margin: 0 auto;
  object-fit: contain;
  object-position: center center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
  pointer-events: none;
  user-select: none;
}

.party-pick-sparkle {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.85) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 18%, rgba(255, 215, 0, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 48% 62%, rgba(255, 255, 255, 0.75) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 84% 58%, var(--member-color, #ffd700) 0 2px, transparent 3px),
    radial-gradient(circle at 12% 70%, rgba(255, 229, 150, 0.8) 0 2px, transparent 3px);
  mix-blend-mode: screen;
}

.party-pick-order {
  position: absolute;
  top: 16px;
  right: 6px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: #b8941f;
  color: #000;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.party-pick-order-num {
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  color: #000;
}

.party-pick-card:not(.selected) .party-pick-order {
  display: none;
}

.party-pick-footer {
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  padding: 8px 10px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.48);
  border: none;
  border-radius: 8px;
}

.party-pick-class-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 0 6px var(--member-color, #fff));
}

.party-pick-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.party-pick-name-ko {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  white-space: nowrap;
}

.party-pick-name-en {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.15;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .party-select {
    max-width: 100%;
  }

  .party-roster-row {
    flex-wrap: wrap;
    max-width: 400px;
  }

  .party-pick-card {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    max-width: none;
    min-height: 260px;
  }

  .party-pick-illust,
  .party-pick-illust-frame {
    flex-basis: 190px;
    height: 190px;
  }

  .party-pick-illust-frame img {
    height: 190px;
  }
}

@media (pointer: coarse) and (max-height: 620px),
       (pointer: coarse) and (max-width: 760px) {
  #start-screen {
    justify-content: center;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  #start-screen .start-panel {
    width: min(100%, 980px);
    max-height: calc(100svh - 20px);
  }

  #start-screen .start-panel h1 {
    margin-bottom: 4px;
    font-size: clamp(34px, 8vw, 50px);
    line-height: 1;
  }

  #start-screen .start-subtitle {
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.16em;
  }

  .start-step-heading {
    margin-bottom: 2px;
    font-size: 16px;
    letter-spacing: 0.08em;
  }

  .start-step-desc {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .party-select {
    max-width: min(100%, 760px);
    margin-bottom: 8px;
  }

  .party-select-status {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .party-roster-grid {
    gap: 6px;
    padding: 0 0 6px;
  }

  .party-roster-row {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .party-pick-card {
    flex: 1 1 0;
    width: auto;
    max-width: 112px;
    min-height: 112px;
  }

  .party-pick-illust {
    flex: 0 0 74px;
    height: 74px;
    align-items: center;
  }

  .party-pick-illust-frame {
    width: 70px;
    height: 70px;
    overflow: hidden;
    align-items: center;
    border-radius: 50%;
    background:
      radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.16), transparent 55%),
      rgba(0, 0, 0, 0.34) !important;
  }

  #start-screen .party-pick-illust-frame {
    width: 70px;
    max-width: 70px;
  }

  .party-pick-illust-frame img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center top;
    filter: none;
  }

  .party-pick-footer {
    flex-basis: 34px;
    height: 34px;
    padding: 4px 3px;
  }

  .party-pick-label {
    gap: 4px;
  }

  .party-pick-class-icon {
    flex-basis: 16px;
    width: 16px;
    height: 16px;
  }

  .party-pick-name-ko {
    font-size: 11px;
    letter-spacing: 0;
  }

  .party-pick-name-en {
    display: none;
  }

  .party-pick-order {
    top: 8px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
  }

  #start-screen .party-pick-order {
    top: 8px;
    right: 2px;
  }

  .party-pick-order-num {
    font-size: 11px;
  }

  .start-action-btn {
    margin-top: 4px;
    font-size: 16px;
  }
}

.start-step-heading,
.start-step-desc {
  width: 100%;
  text-align: center;
}

.start-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: grayscale(0.4);
}

.start-subtitle {
  opacity: 1;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.start-after-reveal {
  animation: start-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes start-reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.start-action-btn {
  align-self: center;
  opacity: 1;
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: #ffd700;
  cursor: var(--cursor-arcane-pointer);
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 215, 0, 0.35);
  transition: color 0.15s, text-shadow 0.15s;
}

#start-screen.start-flow-title .start-action-btn {
  pointer-events: none;
}

.start-action-btn:hover:not(:disabled) {
  color: #ffe566;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 229, 102, 0.5);
}

@keyframes party-sparkle-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 8px var(--member-color, #ffd700)) brightness(1);
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px var(--member-color, #ffd700)) brightness(1.08);
    transform: scale(1.015);
  }
}

@keyframes party-sparkle-spin {
  from {
    transform: rotate(0deg) scale(1);
  }
  to {
    transform: rotate(360deg) scale(1.02);
  }
}

@keyframes party-hero-pop {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.start-credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin: 0 auto;
  opacity: 1;
  text-align: center;
  pointer-events: none;
}

.start-credit.start-after-reveal {
  animation: start-credit-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes start-credit-reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.start-credit-label,
.start-credit-name {
  display: block;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  text-align: center;
}

.start-credit-label {
  color: #fff;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.42em;
  padding-right: 0.42em;
  text-indent: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.start-credit-name {
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.18em;
  padding-right: 0.18em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.start-attribution {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 1;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}

.start-attribution.start-after-reveal {
  animation: start-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#master-ui h2 {
  margin-bottom: 8px;
  color: #f0d080;
  font-size: 13px;
  font-weight: 700;
}

.master-readout {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #604c36;
  font-size: 12px;
  font-weight: 400;
}

.master-readout strong {
  color: #e8a060;
}

.master-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.master-grid button {
  min-height: 32px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(200, 160, 80, 0.22);
  border-radius: 6px;
  color: rgba(255, 242, 200, 0.82);
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
}

.master-grid button:hover {
  border-color: #c0392b;
  color: #c0392b;
}

#master-ui {
  inset: 0;
  left: 0;
  bottom: auto;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 100vh;
  min-height: 0;
  padding: 0;
  background: rgba(18, 13, 9, 0.45);
}

#master-ui.hidden {
  display: none;
}

.master-panel {
  width: min(1400px, calc(100vw - 20px));
  height: min(860px, calc(100vh - 20px));
  margin: auto;
  padding: 50px 56px 52px;
  background: #f4e7c8;
  border: 1px solid rgba(200, 160, 80, 0.32);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(255, 242, 200, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.master-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

#master-ui .master-header h2 {
  margin: 0 0 8px;
  color: #f0d080;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 32px;
  font-weight: 700;
}

.master-close {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(88, 58, 38, 0.3);
  border-radius: 6px;
  color: #7b2f24;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-weight: 700;
}

.master-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.master-tabs button {
  min-width: 142px;
  min-height: 42px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(88, 58, 38, 0.24);
  border-radius: 6px;
  color: #604c36;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

.master-tabs button.active {
  background: rgba(200, 160, 80, 0.14);
  border-color: rgba(200, 160, 80, 0.65);
  color: #f0d080;
}

.master-tab-panel {
  display: none;
  height: calc(100% - 122px);
  min-height: 0;
  overflow-y: auto;
}

.master-tab-panel.active {
  display: block;
}

[data-master-panel="items"].master-tab-panel.active {
  display: flex;
  flex-direction: column;
}

[data-master-panel="items"] .master-collection {
  flex: 1;
  min-height: 0;
}

#master-ui .master-readout {
  justify-content: flex-start;
  gap: 20px;
  margin: 0;
  font-size: 13px;
}

#master-ui .master-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

#master-ui .master-grid button {
  min-height: 68px;
  font-size: 15px;
  font-weight: 700;
}

#master-ui .master-grid button.active {
  background: rgba(143, 43, 32, 0.86);
  border-color: rgba(255, 238, 180, 0.85);
  color: #fff4bf;
  text-shadow: 0 0 8px rgba(255, 215, 80, 0.55);
}

.master-concept-skip-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-concept-skip-grid button.active {
  border-color: #c9a6ff;
  background: rgba(118, 72, 188, 0.28);
}

.master-concept-skip-grid button[data-master-concept="hell"].active {
  border-color: #ff9a78;
  background: rgba(188, 58, 32, 0.28);
}

.master-control-sections {
  display: grid;
  gap: 18px;
  height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.master-control-section {
  padding: 16px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(88, 58, 38, 0.16);
  border-radius: 8px;
}

.master-control-section h3 {
  margin-bottom: 12px;
  color: #f0d080;
  font-size: 16px;
  font-weight: 700;
}

.master-collection {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  height: 100%;
  padding-right: 4px;
  overflow: auto;
}

.master-entry {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(88, 58, 38, 0.18);
  border-radius: 8px;
}

.master-entry.owned {
  border-color: rgba(143, 43, 32, 0.5);
  background: rgba(255, 245, 219, 0.7);
}

.master-entry img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.master-entry-body {
  min-width: 0;
}

.master-entry-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.master-entry-title strong {
  overflow: hidden;
  color: #3f2a14;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-entry-tier {
  color: #e8a060;
  font-size: 11px;
  font-weight: 700;
}

.master-entry p {
  display: -webkit-box;
  overflow: hidden;
  color: #765f45;
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.master-entry-count {
  color: #e8a060;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.master-entry-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.master-entry-actions button {
  min-width: 0;
  min-height: 34px;
  padding: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(200, 160, 80, 0.22);
  border-radius: 6px;
  color: rgba(255, 242, 200, 0.82);
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.master-entry-actions button:hover,
.master-close:hover,
.master-tabs button:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.master-awaken-active {
  background: rgba(180, 20, 0, 0.18) !important;
  border-color: #cc2200 !important;
  color: #cc2200 !important;
}

.master-entry--awakened {
  outline: 1.5px solid rgba(204, 34, 0, 0.6);
  box-shadow: 0 0 8px rgba(204, 34, 0, 0.18);
}

.master-item-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.master-item-toolbar button {
  min-height: 34px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(200, 160, 80, 0.22);
  border-radius: 6px;
  color: rgba(255, 242, 200, 0.88);
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.master-item-toolbar button:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.master-rune-slot-readout {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.master-runeword-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-runeword-list .master-entry {
  min-height: auto;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
}

.master-runeword-list .master-entry--clickable {
  cursor: pointer;
}

.master-runeword-list .master-entry--clickable:hover {
  border-color: rgba(125, 211, 252, 0.7);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.26), 0 8px 22px rgba(8, 47, 73, 0.24);
}

.master-rune-combo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.master-rune-combo strong {
  flex-shrink: 0;
  margin-right: 2px;
}

.master-rune-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(90, 58, 23, 0.1);
  border: 1px solid rgba(90, 58, 23, 0.22);
  font-size: 11px;
  color: var(--ui-ink);
}

.master-rune-chip em {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: var(--ui-accent-gold);
  opacity: 0.85;
}

.master-rune-chip-sep {
  font-size: 11px;
  color: var(--ui-ink-muted);
  opacity: 0.6;
}

.master-entry .rune-tile {
  width: 48px;
  height: 54px;
  margin-right: 2px;
}

#rune-ui {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: min(96vw, 520px);
}

#rune-ui::before {
  content: "RUNES";
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.42);
}

#rune-ui.hidden {
  display: none;
}

.rune-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  max-width: 340px;
  padding: 6px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.55), rgba(8, 10, 18, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rune-slot,
.rune-tile {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  vertical-align: top;
  flex-shrink: 0;
}

.rune-slot--len-1 {
  width: 34px;
  height: 42px;
}

.rune-slot--len-2 {
  width: 40px;
  height: 48px;
}

.rune-slot--len-3 {
  width: 44px;
  height: 52px;
}

.rune-slot-stone {
  position: absolute;
  inset: 0;
  background: url("../assets/item/Runestone.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.rune-slot-symbol {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 1;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #080808;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1),
    0 -1px 0 rgba(0, 0, 0, 0.62),
    0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.rune-slot--len-3 .rune-slot-symbol {
  font-size: 10px;
  letter-spacing: 0.12em;
  bottom: 7px;
}

.rune-slot--empty .rune-slot-stone {
  opacity: 0.26;
  filter: grayscale(0.35) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.rune-slot--empty .rune-slot-symbol {
  display: none;
}

.rune-slot--advanced .rune-slot-stone::after {
  content: "";
  position: absolute;
  inset: 3px 4px 5px;
  border: 1.5px solid rgba(212, 175, 55, 0.78);
  border-radius: 3px 3px 14px 14px;
  box-shadow: inset 0 0 6px rgba(212, 175, 55, 0.2);
  pointer-events: none;
}

.rune-slot--active {
  animation: rune-slot-glow 1.6s ease-in-out infinite;
}

.rune-tile {
  width: 44px;
  height: 52px;
}

.rune-slot-meta {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.25;
}

@keyframes rune-slot-glow {
  0%, 100% {
    box-shadow:
      0 0 0 1.5px color-mix(in srgb, var(--rune-glow, #74b9ff) 50%, transparent),
      0 0 6px color-mix(in srgb, var(--rune-glow, #74b9ff) 35%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 2px var(--rune-glow, #74b9ff),
      0 0 14px color-mix(in srgb, var(--rune-glow, #74b9ff) 68%, transparent);
  }
}

@keyframes rune-symbol-glow {
  0%, 100% {
    color: rgba(212, 175, 55, 0.78);
    text-shadow:
      0 0 4px rgba(212, 175, 55, 0.55),
      0 0 8px rgba(212, 175, 55, 0.3);
  }
  50% {
    color: rgba(255, 228, 110, 1);
    text-shadow:
      0 0 6px rgba(255, 220, 80, 1),
      0 0 14px rgba(212, 175, 55, 0.8),
      0 0 24px rgba(180, 140, 30, 0.5);
  }
}

.rune-word-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.rune-word-chip {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rune-word-color, #2ecc71) 70%, white);
  background: rgba(8, 10, 18, 0.78);
  color: var(--rune-word-color, #2ecc71);
  font-size: 11px;
  font-weight: 700;
}

#rune-discard-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
}

#rune-discard-overlay.hidden {
  display: none;
}

.rune-discard-panel {
  width: min(92vw, 520px);
  padding: 1.1rem 1.2rem 1rem;
  border-radius: 14px;
  background: rgba(12, 14, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
}

.rune-discard-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.rune-discard-panel p {
  margin: 0 0 0.8rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
}

.rune-discard-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.rune-discard-slot {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: auto;
  height: auto;
  padding: 2px 4px 0;
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.rune-discard-slot:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.rune-discard-slot .rune-slot-meta {
  max-width: 72px;
}

.rune-discard-slot--new {
  pointer-events: none;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(46, 204, 113, 0.35));
}

.rune-discard-cancel {
  width: 100%;
  margin-top: 4px;
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
}

#pause-overlay.hidden {
  display: none;
}

#levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.78);
  isolation: isolate;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#levelup-overlay.hidden {
  display: none;
}

#levelup-overlay.artifact-choice-active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.levelup-panel {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 32px));
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.levelup-panel h1 {
  margin-bottom: 18px;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  color: #f0d080;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.75);
}

#upgrade-options {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: 18px;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 6px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 58, 23, 0.36) transparent;
}

#upgrade-options::-webkit-scrollbar {
  height: 8px;
}

#upgrade-options::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
}

#upgrade-options::-webkit-scrollbar-thumb {
  background: rgba(90, 58, 23, 0.36);
  border-radius: 999px;
}

.upgrade-option {
  display: flex;
  box-sizing: border-box;
  flex: 0 0 260px;
  width: 260px;
  max-width: 260px;
  min-height: 436px;
  padding: 86px 44px 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fbf3dc;
  border: 1px solid rgba(200, 160, 80, 0.38);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(255, 242, 200, 0.92);
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  text-align: center;
  transition: transform 0.12s ease, filter 0.12s ease;
  position: relative;
  opacity: 1;
  visibility: visible;
  backface-visibility: hidden;
  transform: translateZ(0);
  box-shadow: 0 16px 36px rgba(75, 45, 22, 0.22);
}

.upgrade-option .key-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: rgba(90, 58, 23, 0.82);
  color: #f5dfa0;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

@keyframes artifactSelected {
  0%   { transform: translateY(0) scale(1); filter: brightness(1); }
  30%  { transform: translateY(-14px) scale(1.045); filter: brightness(1.35) drop-shadow(0 0 18px #ffe480); }
  60%  { transform: translateY(-8px) scale(1.03); filter: brightness(1.25) drop-shadow(0 0 10px #ffcc44); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes artifactDismiss {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(60px); }
}

.upgrade-option.choosing-selected {
  animation: artifactSelected 0.45s ease forwards;
  pointer-events: none;
}

.upgrade-option.choosing-dismissed {
  animation: artifactDismiss 0.38s ease forwards;
  pointer-events: none;
}

.upgrade-option-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(75, 45, 22, 0.22));
}

.upgrade-option:hover {
  filter: brightness(1.06);
  transform: translateY(-5px);
}

.upgrade-option strong {
  display: block;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  color: #3f2a14;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.artifact-lv-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #c0392b;
  pointer-events: none;
}

/* 각성 카드 스타일 */
.upgrade-option-awaken {
  background: #f2cfae;
  border: 1px solid rgba(220, 20, 60, 0.72);
  box-shadow: 0 0 18px rgba(180, 0, 0, 0.35), inset 0 0 24px rgba(200, 0, 0, 0.10), inset 0 1px 0 rgba(255, 80, 80, 0.08);
}

.upgrade-option-awaken:hover {
  filter: brightness(1.10) saturate(1.15);
  transform: translateY(-5px);
  box-shadow: 0 0 28px rgba(220, 50, 50, 0.55), inset 0 0 24px rgba(200, 0, 0, 0.14);
}

.upgrade-option-awaken strong {
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255, 60, 60, 0.45);
}

.awaken-tag {
  color: #ff2222 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px rgba(255, 60, 60, 0.6);
}

.upgrade-option-icon-awaken {
  filter: drop-shadow(0 0 6px rgba(255, 60, 60, 0.65)) drop-shadow(0 2px 4px rgba(120, 0, 0, 0.3)) !important;
}

.upgrade-option-awaken span:not(.key-hint):not(.awaken-tag) {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artifact-badge--awakened {
  border-color: #cc2200 !important;
  box-shadow: 0 0 8px rgba(204, 34, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.18);
}

@keyframes awakenPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(180, 0, 0, 0.35), inset 0 0 24px rgba(200, 0, 0, 0.10); }
  50%       { box-shadow: 0 0 32px rgba(220, 40, 40, 0.62), inset 0 0 28px rgba(200, 0, 0, 0.18); }
}

.upgrade-option-awaken {
  animation: awakenPulse 2s ease-in-out infinite;
}

#upgrade-options:has(.upgrade-option-awaken) .upgrade-option {
  flex: 0 0 240px;
  width: 240px;
  max-width: 240px;
}

.artifact-choice-discard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(220px, calc(100vw - 64px));
  height: 44px;
  margin: 8px auto 0;
  background: rgba(48, 34, 24, 0.82);
  border: 1px solid rgba(255, 224, 160, 0.34);
  border-radius: 8px;
  color: #f3d8a0;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(54, 33, 18, 0.22);
  transition: transform 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}

.key-hint--discard {
  position: static;
  transform: none;
  left: auto;
  width: 22px;
  height: 22px;
  font-size: 13px;
  background: rgba(46, 35, 20, 0.88);
}

.artifact-choice-discard:hover {
  border-color: rgba(220, 70, 52, 0.72);
  color: #fff0c2;
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.artifact-choice-discard.choosing-dismissed {
  animation: artifactDismiss 0.32s ease forwards;
  pointer-events: none;
}

.upgrade-option span {
  color: #604c36;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

.pause-panel {
  display: flex;
  width: min(460px, calc(100vw - 32px));
  min-height: 258px;
  padding: 50px 64px 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f4e7c8;
  border: 1px solid rgba(200, 160, 80, 0.32);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
}

.pause-panel h1 {
  margin-bottom: 8px;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  color: #f0d080;
  font-size: 24px;
  font-weight: 700;
}

.pause-panel p {
  color: #604c36;
  font-size: 13px;
  font-weight: 400;
}

#ult-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#ult-overlay.hidden {
  display: none;
}

.ult-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  animation: ult-flash var(--ult-flash-duration, 0.3s) ease-out forwards;
}

@keyframes ult-flash {
  0%   { opacity: 0.85; }
  100% { opacity: 0; }
}

.ult-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  animation: ult-bg var(--ult-overlay-duration, 1s) ease forwards;
}

@keyframes ult-bg {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  72%  { opacity: 0.85; }
  100% { opacity: 0; }
}

.ult-illustration {
  position: relative;
  height: 72vh;
  max-height: 620px;
  object-fit: contain;
  filter: drop-shadow(0 0 32px rgba(255, 255, 255, 0.25));
  animation: ult-pop var(--ult-overlay-duration, 1s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ult-pop {
  0%   { opacity: 0; transform: scale(0.35) translateY(60px); }
  18%  { opacity: 1; transform: scale(1.07) translateY(-12px); }
  32%  { transform: scale(0.97) translateY(4px); }
  44%  { transform: scale(1.01) translateY(0); }
  72%  { opacity: 1; transform: scale(1.0) translateY(0); }
  100% { opacity: 0; transform: scale(1.04) translateY(-14px); }
}

.ult-label {
  position: absolute;
  bottom: 12vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: ult-label-in var(--ult-overlay-duration, 1s) ease forwards;
}

@keyframes ult-label-in {
  0%   { opacity: 0; transform: translateX(-50%) translateY(16px); }
  22%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

.ult-role {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.25em;
}

.ult-skill-name {
  color: #fff;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.5);
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

#overlay.hidden {
  display: none;
}

.panel {
  display: flex;
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 32px), calc((100vh - 40px) * 1.7835));
  height: min(662px, calc(100vh - 40px), calc((100vw - 32px) / 1.7835));
  aspect-ratio: 1491 / 836;
  padding: min(62px, 6.8%) min(112px, 9.5%) min(54px, 6%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #f4e7c8;
  border: 1px solid rgba(200, 160, 80, 0.32);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.panel h1 {
  color: #f0d080;
  margin-bottom: 10px;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.panel p {
  color: #604c36;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 400;
}

#result-stats {
  width: 100%;
  margin-top: 8px;
  color: #604c36;
}

.result-total-damage {
  margin-bottom: 8px;
  font-size: 12px;
}

.result-defeat-cause {
  margin-bottom: 6px;
  font-size: 12px;
}

.result-defeat-cause strong {
  color: #c94b42;
  font-size: 15px;
}

.result-total-damage strong {
  color: #e8a060;
  font-size: 15px;
}

.result-stat-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  text-align: left;
}

.result-stat-section {
  min-width: 0;
}

.result-stat-section h2 {
  margin: 0 0 6px;
  color: #e8a060;
  font-size: 11px;
  font-weight: 700;
}

.result-stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 7px;
  align-items: center;
  margin-bottom: 5px;
  font-size: 10.5px;
}

.result-stat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-stat-damage {
  color: #e8a060;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.result-stat-bar {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  background: rgba(96, 76, 54, 0.16);
}

.result-stat-bar i {
  display: block;
  height: 100%;
  background: #c0392b;
}

.result-stat-empty {
  font-size: 11px;
  opacity: 0.72;
}

#restart {
  margin-top: 12px;
  padding: 0;
  font-size: 14px;
  background: transparent;
  color: #e8a060;
  border: none;
  cursor: var(--cursor-arcane-pointer);
  font: inherit;
  font-weight: 700;
}

#restart:hover {
  color: #c0392b;
}

@media (max-width: 680px) {
  .panel {
    width: calc(100vw - 18px);
    height: calc((100vw - 18px) / 1.7835);
    max-height: calc(100vh - 18px);
    padding: 26px 38px 24px;
    overflow-y: auto;
  }

  .result-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  #party-ui {
    top: 50%;
    right: 8px;
  }

  #party-list {
    gap: 8px;
  }

  .party-member {
    width: 52px;
    height: 52px;
  }

  #skill-ui {
    right: 8px;
    bottom: 74px;
    left: auto;
    grid-template-columns: repeat(4, 60px);
    gap: 8px;
  }

  #bottom-bars {
    bottom: 0;
    left: 0;
    right: 0;
    height: 18px;
    width: auto;
    min-height: 0;
    padding: 0;
    transform: none;
  }

  .skill-slot {
    width: 60px;
    height: 80px;
    min-width: 0;
  }

  .skill-icon,
  .potion-icon {
    width: 56px;
    height: 56px;
    padding: 11px;
  }

  .skill-cooldown,
  .potion-cooldown {
    width: 56px;
    height: 56px;
    inset: 0 4px 20px 0;
  }

  #potion-slot {
    right: 272px;
    bottom: 74px;
    width: 60px;
    height: 80px;
  }

  #master-ui {
    inset: 0;
    width: auto;
    min-height: 0;
    padding: 0;
  }

  .master-panel {
    width: calc(100vw - 18px);
    height: calc(100vh - 18px);
    padding: 34px 28px 36px;
  }

  #master-ui .master-grid,
  .master-collection {
    grid-template-columns: 1fr;
  }

  .master-entry {
    grid-template-columns: 34px minmax(0, 1fr) 48px;
  }

  .master-entry-actions {
    grid-column: 1 / -1;
  }

  .pause-panel {
    min-height: 224px;
    padding: 48px 48px 42px;
  }

  .panel {
    width: min(calc(100vw - 18px), calc((100vh - 18px) * 1.7835));
    height: min(calc(100vh - 18px), calc((100vw - 18px) / 1.7835));
    aspect-ratio: 1491 / 836;
    min-height: 0;
    padding: 26px 38px 24px;
    overflow-y: auto;
  }

  .pause-panel h1,
  .panel h1 {
    margin-bottom: 5px;
    font-size: 15px;
  }

  .panel p,
  .result-total-damage {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .result-total-damage strong {
    font-size: 11px;
  }

  .result-stat-grid {
    gap: 7px;
  }

  .result-stat-section h2 {
    margin-bottom: 3px;
    font-size: 9px;
  }

  .result-stat-row {
    gap: 2px 4px;
    margin-bottom: 2px;
    font-size: 8px;
  }

  .result-stat-bar {
    height: 3px;
  }

  #restart {
    margin-top: 5px;
    font-size: 10px;
  }

  #info-panel {
    width: calc(100vw - 18px);
    min-height: calc(100vh - 90px);
    padding: 52px 42px 46px;
  }

  .info-header {
    margin-bottom: 14px;
  }

  .info-header h2 {
    font-size: 22px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .info-section h3,
  #info-upgrades h4 {
    margin-bottom: 8px;
    font-size: 15px;
  }

  #info-upgrades ul {
    max-height: 118px;
  }

  #upgrade-options {
    gap: 8px;
    justify-content: center;
    overflow-x: auto;
  }

  .upgrade-option {
    flex: 0 0 232px;
    width: 232px;
    max-width: 232px;
    min-height: 300px;
    padding: 68px 22px 42px;
  }

  .upgrade-option strong {
    font-size: 17px;
  }

  .upgrade-option span {
    font-size: 12px;
  }
}

/* Light parchment interface theme */
:root {
  --ui-parchment: rgba(249, 239, 214, 0.97);
  --ui-parchment-soft: rgba(255, 248, 230, 0.94);
  --ui-parchment-deep: rgba(236, 218, 177, 0.96);
  --ui-ink: #2f2418;
  --ui-ink-muted: #725f45;
  --ui-line: rgba(119, 82, 38, 0.34);
  --ui-line-strong: rgba(119, 82, 38, 0.58);
  --ui-accent-warm: #9a4f24;
  --ui-accent-gold: #b77a24;
  --ui-shadow-soft: 0 12px 32px rgba(64, 42, 22, 0.24);
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel {
  color: var(--ui-ink);
  text-shadow: none;
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel,
.upgrade-option {
  background: #f4e7c8;
  border-color: var(--ui-line-strong);
  color: var(--ui-ink);
  box-shadow: 0 18px 56px rgba(64, 42, 22, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  position: relative;
  -webkit-mask:
    radial-gradient(circle at 0 0, transparent 0 13px, #000 13.5px) top left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 0, transparent 0 13px, #000 13.5px) top right / 50% 50% no-repeat,
    radial-gradient(circle at 0 100%, transparent 0 13px, #000 13.5px) bottom left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 0 13px, #000 13.5px) bottom right / 50% 50% no-repeat;
  mask:
    radial-gradient(circle at 0 0, transparent 0 13px, #000 13.5px) top left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 0, transparent 0 13px, #000 13.5px) top right / 50% 50% no-repeat,
    radial-gradient(circle at 0 100%, transparent 0 13px, #000 13.5px) bottom left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 0 13px, #000 13.5px) bottom right / 50% 50% no-repeat;
}

#info-panel::before,
.master-panel::before,
.pause-panel::before,
.panel::before,
.rune-discard-panel::before,
.upgrade-option::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 2px solid rgba(42, 29, 16, 0.78);
  -webkit-mask:
    radial-gradient(circle at 0 0, transparent 0 10px, #000 10.5px) top left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 0, transparent 0 10px, #000 10.5px) top right / 50% 50% no-repeat,
    radial-gradient(circle at 0 100%, transparent 0 10px, #000 10.5px) bottom left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 0 10px, #000 10.5px) bottom right / 50% 50% no-repeat;
  mask:
    radial-gradient(circle at 0 0, transparent 0 10px, #000 10.5px) top left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 0, transparent 0 10px, #000 10.5px) top right / 50% 50% no-repeat,
    radial-gradient(circle at 0 100%, transparent 0 10px, #000 10.5px) bottom left / 50% 50% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 0 10px, #000 10.5px) bottom right / 50% 50% no-repeat;
}

#info-panel *,
.master-panel *,
.pause-panel *,
.panel *,
.rune-discard-panel * {
  text-shadow: none;
}

.levelup-panel h1,
.pause-panel h1,
.panel h1,
.info-header h2,
#master-ui h2,
.master-panel h2,
.info-section h3,
#info-upgrades h4,
.master-control-section h3,
#info-stage,
#info-upgrades li strong,
.master-readout strong,
.master-entry-tier,
.master-entry-count,
.result-total-damage strong,
.result-stat-section h2,
.result-stat-damage {
  color: var(--ui-accent-warm);
}

.pause-panel p,
.panel p,
.rune-discard-panel p,
.info-section,
.info-section p,
#info-upgrades li,
.master-readout,
.master-entry,
.master-control-section,
.master-hint,
.upgrade-option span {
  color: var(--ui-ink-muted);
}

.upgrade-option,
.info-section,
#info-upgrades li,
.master-entry,
.master-control-section,
.master-readout {
  background: #fbf3dc;
  border-color: var(--ui-line);
  color: var(--ui-ink);
  box-shadow: 0 8px 20px rgba(64, 42, 22, 0.16);
}

.upgrade-option:hover,
.upgrade-option.choosing-selected,
.master-entry:hover {
  background: #ead39b;
  border-color: var(--ui-accent-gold);
  box-shadow: 0 12px 28px rgba(64, 42, 22, 0.22);
}

.upgrade-option strong,
.upgrade-option .key-hint,
.artifact-lv-tag,
.awaken-tag {
  color: var(--ui-ink);
}

.upgrade-option .key-hint,
.artifact-lv-tag,
.awaken-tag {
  background: rgba(255, 252, 240, 0.82);
  border-color: var(--ui-line);
}

.upgrade-option-awaken {
  background: #f2cfae;
  border-color: rgba(160, 56, 36, 0.58);
}

.upgrade-option-awaken:hover,
.upgrade-option-awaken.choosing-selected {
  background: #efbc9a;
  border-color: rgba(160, 56, 36, 0.82);
}

.upgrade-option-awaken strong,
.upgrade-option-awaken span:not(.key-hint):not(.awaken-tag) {
  color: #7a2b1f;
}

.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button {
  background: #f8edd0;
  border-color: var(--ui-line);
  color: var(--ui-ink);
  box-shadow: 0 6px 14px rgba(64, 42, 22, 0.16);
}

.master-tabs button.active,
#master-ui .master-grid button.active,
.master-grid button:hover,
.master-entry-actions button:hover,
.master-close:hover,
.info-close:hover,
.pause-panel button:hover,
.panel button:hover,
.rune-discard-panel button:hover {
  background: #ead39b;
  border-color: var(--ui-accent-gold);
  color: var(--ui-ink);
  text-shadow: none;
}

#master-ui .master-panel {
  background: rgba(244, 231, 200, 0.94);
  border-color: var(--ui-line-strong);
  color: var(--ui-ink);
}

#master-ui .master-header h2,
#master-ui h2,
#master-ui .master-control-section h3 {
  color: var(--ui-accent-warm);
}

#master-ui .master-readout,
#master-ui .master-rune-slot-readout,
#master-ui .master-entry p {
  color: var(--ui-ink-muted);
}

#master-ui .master-readout strong,
#master-ui .master-entry-title strong,
#master-ui .master-entry-tier,
#master-ui .master-entry-count {
  color: var(--ui-ink);
}

#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-close {
  background: #f8edd0;
  border-color: var(--ui-line);
  color: var(--ui-ink);
  text-shadow: none;
}

#master-ui .master-tabs button:hover,
#master-ui .master-grid button:hover,
#master-ui .master-entry-actions button:hover,
#master-ui .master-close:hover {
  background: #ead39b;
  border-color: var(--ui-accent-gold);
  color: var(--ui-ink);
}

#master-ui .master-tabs button.active,
#master-ui .master-grid button.active,
#master-ui .master-entry-actions button:active {
  background: #e6bf72;
  border-color: var(--ui-accent-gold);
  color: var(--ui-ink);
  box-shadow: inset 0 0 0 1px rgba(119, 82, 38, 0.2), 0 8px 18px rgba(64, 42, 22, 0.18);
  text-shadow: none;
}

#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout {
  background: #fbf3dc;
  border-color: var(--ui-line);
  color: var(--ui-ink);
}

#master-ui .master-entry.owned {
  background: #efe0b3;
  border-color: rgba(183, 122, 36, 0.62);
}

#master-ui .master-awaken-active,
#master-ui .master-entry--awakened {
  background: #f2cfae !important;
  border-color: rgba(160, 56, 36, 0.72) !important;
  color: #7a2b1f !important;
  box-shadow: 0 0 0 1px rgba(160, 56, 36, 0.16), 0 8px 18px rgba(64, 42, 22, 0.16);
}

#levelup-overlay,
#pause-overlay,
#overlay,
#info-overlay,
#rune-discard-overlay {
  background: rgba(32, 23, 14, 0.46);
}

/* Start title screen keeps the original transparent presentation. */
#start-screen .start-panel {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #fff;
}

#start-screen .start-panel *,
#start-screen .start-panel h1,
#start-screen .start-subtitle {
  color: #fff;
}

#start-screen .start-panel h1 {
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

#start-screen .start-subtitle {
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

#start-screen .start-action-btn {
  position: relative;
  z-index: 4;
  pointer-events: auto;
  background: none;
  border: none;
  box-shadow: none;
  color: #ffd700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 215, 0, 0.35);
}

#start-screen .start-action-btn:hover:not(:disabled) {
  color: #ffe566;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 229, 102, 0.5);
}

#start-screen .party-pick-card,
#start-screen .party-pick-card:hover:not(.disabled),
#start-screen .party-pick-card.selected,
#start-screen .party-pick-illust,
#start-screen .party-pick-illust-frame,
#start-screen .party-pick-footer,
#start-screen .party-pick-label {
  background: transparent;
  border: none;
  box-shadow: none;
}

#start-screen .party-pick-card:hover:not(.disabled) {
  filter: brightness(1.05);
}

#start-screen .party-pick-card.selected {
  filter: brightness(1.08);
}

#start-screen .party-pick-illust-frame {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

#start-screen .party-pick-order,
#start-screen .party-pick-order-num {
  background: #b8941f;
  border: none;
  color: #000;
}

#start-screen .party-pick-order {
  top: 16px;
  right: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

#start-screen .party-pick-name-ko {
  color: #fff;
}

#start-screen .party-pick-name-en {
  color: rgba(255, 255, 255, 0.55);
}

#stats,
#skill-ui,
#skill-ui .skill-slot {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.pause-panel {
  border-radius: 0;
}

#info-panel {
  width: min(1680px, calc(100vw - 20px));
  min-height: auto;
  max-height: calc(100vh - 20px);
  padding: 32px 40px 36px;
  overflow: auto;
  box-shadow: none;
}

#info-panel .info-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ui-line);
}

#info-panel .info-grid {
  grid-template-columns: minmax(200px, 0.9fr) minmax(240px, 1fr) minmax(280px, 1.15fr);
  gap: 18px;
  align-items: start;
}

#info-panel .info-upgrade-section {
  grid-column: 1 / -1;
  padding: 16px 0 0;
  border-top: 1px solid var(--ui-line);
  border-right: none;
}

#info-panel .info-section,
#info-panel #info-upgrades li {
  background: transparent;
  border: none;
  box-shadow: none;
}

#info-panel .info-section {
  padding: 0 18px 0 0;
  border-right: 1px solid var(--ui-line);
}

#info-panel .info-section:last-child {
  padding-right: 0;
  border-right: none;
}

#info-panel .info-section dl div,
#info-panel .info-skill-row {
  border-bottom-color: rgba(119, 82, 38, 0.2);
}

#info-panel #info-upgrades {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

#info-panel .info-upgrade-group {
  min-width: 0;
}

#info-panel #info-upgrades ul {
  grid-template-columns: 1fr;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

#info-panel .info-legend {
  grid-column: 1 / -1;
  margin-top: 0;
}

@media (max-width: 980px) {
  #info-panel .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #info-panel .info-upgrade-section {
    grid-column: 1 / -1;
  }

  #info-panel #info-upgrades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #info-panel .info-section:nth-child(2n) {
    padding-right: 0;
    border-right: none;
  }
}

@media (max-width: 680px) {
  #info-panel {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    padding: 24px 20px 26px;
  }

  #info-panel .info-grid {
    grid-template-columns: 1fr;
  }

  #info-panel #info-upgrades ul {
    grid-template-columns: 1fr;
  }

  #info-panel #info-upgrades {
    grid-template-columns: 1fr;
  }

  #info-panel .info-section {
    padding: 0 0 14px;
    border-right: none;
    border-bottom: 1px solid var(--ui-line);
  }

  #info-panel .info-section:last-child {
    border-bottom: none;
  }
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel {
  background: rgba(244, 231, 200, 0.94);
}

.upgrade-option,
.info-section,
#info-upgrades li,
.master-entry,
.master-control-section,
.master-readout,
#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout {
  background: #fbf3dc;
}

.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button,
#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-close {
  background: #f8edd0;
}

.upgrade-option:hover,
.upgrade-option.choosing-selected,
.master-entry:hover,
.master-tabs button.active,
#master-ui .master-tabs button.active,
#master-ui .master-grid button.active,
.master-grid button:hover,
.master-entry-actions button:hover,
.master-close:hover,
.info-close:hover,
.pause-panel button:hover,
.panel button:hover,
.rune-discard-panel button:hover,
#master-ui .master-tabs button:hover,
#master-ui .master-grid button:hover,
#master-ui .master-entry-actions button:hover,
#master-ui .master-close:hover {
  background: #ead39b;
}

.upgrade-option-awaken,
#master-ui .master-awaken-active,
#master-ui .master-entry--awakened {
  background: #f2cfae !important;
}

#master-ui .master-entry.owned {
  background: #efe0b3;
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel,
.upgrade-option,
.info-section,
#info-upgrades li,
.master-entry,
.master-control-section,
.master-readout,
.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button {
  border-radius: 0;
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel {
  width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  max-width: none;
  max-height: calc(100vh - 20px);
  background: rgba(244, 231, 200, 0.84);
  box-shadow: none;
}

#info-panel,
.master-panel {
  overflow: auto;
}

.pause-panel,
.panel,
.rune-discard-panel {
  min-height: 0;
}

.upgrade-option,
.info-section,
#info-upgrades li,
.master-entry,
.master-control-section,
.master-readout,
#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout {
  background: rgba(251, 243, 220, 0.72);
}

.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button,
#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-close {
  background: rgba(248, 237, 208, 0.78);
}

.upgrade-option:hover,
.upgrade-option.choosing-selected,
.master-entry:hover,
.master-tabs button.active,
#master-ui .master-tabs button.active,
#master-ui .master-grid button.active,
.master-grid button:hover,
.master-entry-actions button:hover,
.master-close:hover,
.info-close:hover,
.pause-panel button:hover,
.panel button:hover,
.rune-discard-panel button:hover,
#master-ui .master-tabs button:hover,
#master-ui .master-grid button:hover,
#master-ui .master-entry-actions button:hover,
#master-ui .master-close:hover {
  background: rgba(234, 211, 155, 0.82);
}

.pause-panel {
  width: min(420px, calc(100vw - 32px));
  height: auto;
  min-height: 180px;
  max-height: none;
  padding: 38px 48px 34px;
  background: rgba(192, 159, 105, 0.9);
}

#master-ui,
#master-ui *,
#master-ui *::before,
#master-ui *::after {
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

#master-ui .master-panel {
  background: rgba(244, 231, 200, 0.94);
  border-color: rgba(119, 82, 38, 0.24);
}

#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout,
#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-close {
  background: rgba(246, 234, 205, 0.72);
  border-color: rgba(119, 82, 38, 0.18);
}

#master-ui .master-entry:hover,
#master-ui .master-entry.owned,
#master-ui .master-tabs button:hover,
#master-ui .master-tabs button.active,
#master-ui .master-grid button:hover,
#master-ui .master-grid button.active,
#master-ui .master-entry-actions button:hover,
#master-ui .master-entry-actions button:active,
#master-ui .master-close:hover {
  background: rgba(241, 226, 190, 0.78);
  border-color: rgba(119, 82, 38, 0.28);
}

#master-ui .master-awaken-active,
#master-ui .master-entry--awakened {
  background: rgba(239, 210, 184, 0.82) !important;
  border-color: rgba(160, 56, 36, 0.38) !important;
  outline-color: rgba(160, 56, 36, 0.36);
}

/* Flat interface pass: simple borders and spacing, no radius or shadow. */
#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel,
.upgrade-option,
.info-section,
#info-upgrades li,
.master-entry,
.master-control-section,
.master-readout,
.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button,
.rune-slots,
.rune-word-chip,
.rune-discard-slot,
.rune-discard-cancel,
#master-ui .master-panel,
#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout,
#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-close {
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

#info-panel,
.master-panel,
.pause-panel,
.panel,
.rune-discard-panel {
  background: #efe2c2;
  border: 1px solid rgba(72, 52, 28, 0.34);
  color: #2e251b;
}

.upgrade-option,
.info-section,
#info-upgrades li,
.master-control-section,
.master-entry,
.master-readout,
#master-ui .master-control-section,
#master-ui .master-entry,
#master-ui .master-readout {
  background: rgba(248, 239, 216, 0.52);
  border: 1px solid rgba(72, 52, 28, 0.16);
  color: #2e251b;
}

.master-entry + .master-entry,
#info-upgrades li + li {
  border-top-color: rgba(72, 52, 28, 0.24);
}

.master-tabs,
.master-control-section,
.master-readout,
.master-collection,
.master-runeword-list {
  gap: 8px;
}

.master-tabs button,
.master-grid button,
.master-entry-actions button,
.master-item-toolbar button,
.master-close,
.info-close,
.pause-panel button,
.panel button,
.rune-discard-panel button,
#master-ui .master-tabs button,
#master-ui .master-grid button,
#master-ui .master-entry-actions button,
#master-ui .master-item-toolbar button,
#master-ui .master-close {
  background: rgba(239, 226, 194, 0.84);
  border: 1px solid rgba(72, 52, 28, 0.2);
  color: #312719;
}

.upgrade-option:hover,
.upgrade-option.choosing-selected,
.master-entry:hover,
.master-tabs button.active,
.master-grid button:hover,
.master-grid button.active,
.master-entry-actions button:hover,
.master-entry-actions button:active,
.master-item-toolbar button:hover,
.master-item-toolbar button:active,
.master-close:hover,
.info-close:hover,
.pause-panel button:hover,
.panel button:hover,
.rune-discard-panel button:hover,
#master-ui .master-tabs button:hover,
#master-ui .master-tabs button.active,
#master-ui .master-grid button:hover,
#master-ui .master-grid button.active,
#master-ui .master-entry-actions button:hover,
#master-ui .master-entry-actions button:active,
#master-ui .master-item-toolbar button:hover,
#master-ui .master-item-toolbar button:active,
#master-ui .master-close:hover {
  background: rgba(226, 206, 162, 0.88);
  border-color: rgba(72, 52, 28, 0.36);
  color: #251d12;
}

#master-ui .master-entry.owned,
#master-ui .master-awaken-active,
#master-ui .master-entry--awakened,
.upgrade-option-awaken {
  background: rgba(232, 213, 176, 0.78) !important;
  border-color: rgba(72, 52, 28, 0.32) !important;
  color: #2e251b !important;
  outline: 1px solid rgba(72, 52, 28, 0.18);
}

#master-ui .master-runeword-list .master-entry {
  border-left: 3px solid rgba(72, 52, 28, 0.28);
}

#master-ui .master-runeword-list .master-entry.owned {
  border-left-color: rgba(154, 79, 36, 0.72);
}

/* Artifact choice pass */
#levelup-overlay {
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(2px);
}

.levelup-panel h1 {
  color: #fff;
  text-shadow: none;
}

.upgrade-option,
.upgrade-option-awaken {
  border-radius: 0;
  background: #f3e4bf;
  border: 1px solid rgba(44, 32, 18, 0.58);
  box-shadow: 0 0 0 1px rgba(255, 247, 223, 0.16) inset !important;
  color: #261d13;
  -webkit-mask: none;
  mask: none;
}

.upgrade-option::before,
.upgrade-option::after {
  content: none;
  display: none;
  box-shadow: none;
  border: 0;
}

.upgrade-option .key-hint {
  border-radius: 0;
  box-shadow: none;
  background: #2e2314;
  color: #fff;
}

.artifact-lv-tag,
.awaken-tag {
  background: transparent;
  border: 0;
  color: #2e251b !important;
  font-weight: 900 !important;
  text-shadow: none !important;
}

.upgrade-option-icon,
.upgrade-option-icon-awaken {
  filter: none !important;
}

.upgrade-option:hover {
  filter: none;
  background: #ead39b;
  border-color: rgba(44, 32, 18, 0.78);
}

.upgrade-option.choosing-selected {
  animation: none;
}

.upgrade-option-awaken {
  animation: none;
  background: #e7c09f !important;
  border-color: rgba(95, 32, 22, 0.78) !important;
  outline: none;
}

.upgrade-option-awaken strong {
  color: #2e251b;
  text-shadow: none;
}

.upgrade-option-awaken span:not(.key-hint):not(.awaken-tag) {
  color: #604c36;
}

.rune-slots,
.rune-discard-panel,
.rune-discard-slot,
.rune-discard-cancel {
  background: rgba(239, 226, 194, 0.84);
  border: 1px solid rgba(72, 52, 28, 0.24);
}

.rune-word-chip {
  background: rgba(239, 226, 194, 0.92);
  border: 1px solid rgba(72, 52, 28, 0.28);
  color: #2e251b;
}

#rune-ui {
  bottom: 18px;
  gap: 4px;
}

#rune-ui::before {
  display: none;
}

#rune-ui .rune-slots {
  display: grid;
  grid-template-columns: repeat(5, 66px);
  grid-auto-rows: 82px;
  gap: 8px 12px;
  width: auto;
  max-width: none;
  padding: 0;
  background: transparent;
  border: 0;
}

#rune-ui .rune-slot {
  width: 66px;
  height: 82px;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  overflow: visible;
}

#rune-ui .rune-slot::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 7px;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

#rune-ui .rune-slot--len-1,
#rune-ui .rune-slot--len-2,
#rune-ui .rune-slot--len-3 {
  width: 66px;
  height: 82px;
}

#rune-ui .rune-slot-stone {
  top: 5px;
  left: 8px;
  right: 8px;
  bottom: 27px;
  background: url("../assets/item/Runestone.png") center / contain no-repeat;
  opacity: 0.96;
}

#rune-ui .rune-slot--empty .rune-slot-stone {
  display: block;
  opacity: 0.28;
  filter:
    grayscale(1)
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.34));
}

#rune-ui .rune-slot--empty {
  background: transparent;
}

#rune-ui .rune-slot--empty::before {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
}

#rune-ui .rune-slot-symbol {
  top: 36px;
  bottom: auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #080808;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 -1px 0 rgba(0, 0, 0, 0.62),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

#rune-ui .rune-slot--len-3 .rune-slot-symbol {
  top: 36px;
  font-size: 9px;
  letter-spacing: 0.03em;
}

#rune-ui .rune-slot--advanced .rune-slot-stone::after {
  display: none;
}

#rune-ui .rune-slot-name {
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: 2px;
  display: block;
  color: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}

#rune-ui .rune-slot-tier-tag {
  display: block;
  font-size: 8px;
  font-weight: 600;
  color: rgba(212, 175, 55, 0.92);
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.6), 0 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.04em;
}

#rune-ui .rune-word-list {
  margin-top: 1px;
  gap: 5px;
}

#rune-ui .rune-word-chip {
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.15;
  background: rgba(0, 0, 0, 0.32);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
}

.rune-slot-stone,
.rune-slot--empty .rune-slot-stone,
.rune-discard-slot--new,
#master-ui .rune-slot-stone {
  filter: none !important;
}

#master-ui .rune-slot--active {
  animation: none;
  box-shadow: none;
}

#rune-ui .rune-slot--active {
  animation: rune-word-hud-glow 1.25s ease-in-out infinite !important;
}

#rune-ui .rune-slot--active::before {
  border-color: var(--rune-glow, #74b9ff);
  background: color-mix(in srgb, var(--rune-glow, #74b9ff) 16%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rune-glow, #74b9ff) 72%, white),
    0 0 14px color-mix(in srgb, var(--rune-glow, #74b9ff) 88%, transparent),
    0 0 28px color-mix(in srgb, var(--rune-glow, #74b9ff) 70%, transparent);
}

#rune-ui .rune-slot--active .rune-slot-stone {
  filter:
    drop-shadow(0 0 7px color-mix(in srgb, var(--rune-glow, #74b9ff) 92%, transparent))
    drop-shadow(0 0 14px color-mix(in srgb, var(--rune-glow, #74b9ff) 68%, transparent)) !important;
}

#rune-ui .rune-slot--advanced .rune-slot-stone {
  animation: none;
}

#rune-ui .rune-slot--advanced .rune-slot-symbol {
  animation: rune-symbol-glow 1.8s ease-in-out infinite;
}

@keyframes rune-word-hud-glow {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.28);
  }
}


#rune-discard-overlay {
  background: rgba(0, 0, 0, 0.72);
}

#rune-discard-overlay .rune-discard-panel {
  width: min(520px, calc(100vw - 28px));
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 44px);
  padding: 18px 18px 16px;
  overflow: auto;
  background: #efe2c2;
  border: 1px solid rgba(72, 52, 28, 0.42);
}

#rune-discard-overlay .rune-discard-panel h2 {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.2;
}

#rune-discard-overlay .rune-discard-panel p {
  margin-bottom: 12px;
  color: #604c36;
  font-size: 13px;
  font-weight: 700;
}

#rune-discard-overlay .rune-discard-slots {
  grid-template-columns: repeat(5, 72px);
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

#rune-discard-overlay .rune-discard-slot {
  position: relative;
  width: 72px;
  min-height: 78px;
  padding: 8px 4px 5px;
  background: #f8efd5;
  border: 1px solid rgba(72, 52, 28, 0.22);
  color: #2e251b;
}

#rune-discard-overlay .rune-discard-key-hint {
  position: absolute;
  top: 4px;
  left: 5px;
  z-index: 4;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(46, 35, 20, 0.86);
  color: #f8e6a8;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 10px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

#rune-discard-overlay .rune-discard-slot .rune-slot-stone {
  position: relative;
  width: 34px;
  height: 40px;
}

#rune-discard-overlay .rune-discard-slot .rune-slot-symbol {
  top: 30px;
  bottom: auto;
  font-size: 9px;
}

#rune-discard-overlay .rune-discard-slot .rune-slot-meta {
  max-width: 64px;
  margin-top: 4px;
  color: #604c36;
  font-size: 9px;
}

#rune-discard-overlay .rune-discard-slot--recommended {
  background: #ead39b;
  border-color: rgba(72, 52, 28, 0.62);
  outline: 2px solid rgba(154, 79, 36, 0.55);
}

#rune-discard-overlay .rune-discard-new {
  display: flex;
  justify-content: center;
}

#rune-discard-overlay .rune-discard-slot--new {
  margin-bottom: 8px;
  background: #e8d5b0;
}

#rune-discard-overlay .rune-recommend-badge {
  position: absolute;
  top: -7px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  min-width: max-content;
  padding: 3px 6px;
  background: #2e2314;
  color: #f8e6a8;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

#rune-discard-overlay .rune-discard-cancel {
  display: block;
  width: min(220px, 100%);
  margin: 0 auto;
  padding: 8px 10px;
}

#rune-discard-overlay .rune-discard-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

#rune-discard-overlay .rune-discard-auto,
#rune-discard-overlay .rune-discard-cancel {
  position: relative;
  width: min(160px, 50%);
  margin: 0;
  padding: 8px 10px;
}

#rune-discard-overlay .rune-discard-auto .rune-discard-key-hint,
#rune-discard-overlay .rune-discard-cancel .rune-discard-key-hint {
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
}

#rune-discard-overlay .rune-discard-auto {
  background: #ead39b;
  border-color: rgba(72, 52, 28, 0.42);
  color: #251d12;
  font-weight: 800;
}

/* Modal sizing pass: keep utility panels from filling the entire viewport. */
#info-panel {
  width: min(1080px, calc(100vw - 96px));
  min-height: 0;
  height: auto;
  max-height: min(760px, calc(100vh - 96px));
  padding: 34px 42px 38px;
  overflow: auto;
}

#master-ui {
  padding: 32px;
}

#master-ui .master-panel,
.master-panel {
  width: min(1180px, calc(100vw - 96px));
  height: min(740px, calc(100vh - 96px));
  max-width: 1180px;
  max-height: calc(100vh - 96px);
  padding: 34px 40px 38px;
  overflow: auto;
}

.panel {
  width: min(720px, calc(100vw - 96px));
  height: auto;
  min-height: 0;
  max-width: 720px;
  max-height: calc(100vh - 96px);
  padding: 34px 40px 38px;
  overflow: auto;
}

.pause-panel {
  width: min(380px, calc(100vw - 96px));
  height: auto;
  min-height: 160px;
  max-width: 380px;
  max-height: calc(100vh - 96px);
}

#rune-discard-overlay .rune-discard-panel {
  width: min(500px, calc(100vw - 96px));
  max-height: calc(100vh - 96px);
}

@media (max-width: 760px) {
  #info-panel,
  #master-ui .master-panel,
  .master-panel,
  .panel,
  .pause-panel,
  #rune-discard-overlay .rune-discard-panel {
    width: calc(100vw - 28px);
    max-width: none;
    max-height: calc(100vh - 28px);
  }

  #info-panel,
  #master-ui .master-panel,
  .master-panel,
  .panel {
    padding: 24px 20px 26px;
  }

  #master-ui {
    padding: 14px;
  }
}

@media (pointer: coarse), (max-width: 760px) {
  #info-panel,
  .master-panel,
  .pause-panel,
  .panel,
  .rune-discard-panel,
  .upgrade-option,
  .upgrade-option-awaken {
    -webkit-mask: none;
    mask: none;
  }

  #info-panel::before,
  .master-panel::before,
  .pause-panel::before,
  .panel::before,
  .rune-discard-panel::before {
    content: none;
    display: none;
  }

  #info-panel .info-header,
  #info-panel .info-upgrade-section,
  #info-panel .info-section {
    border-top: none;
    border-bottom: none;
  }
}

#mobile-controls,
#mobile-rotate-overlay {
  display: none;
}

body.mobile-controls-enabled #mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: block;
  pointer-events: none;
}

body.mobile-controls-enabled:not(.playing) #mobile-controls,
body.mobile-portrait:not(.playing) #mobile-rotate-overlay {
  display: none;
}

.mobile-joystick {
  position: absolute;
  left: max(42px, calc(env(safe-area-inset-left) + 42px));
  bottom: max(48px, calc(env(safe-area-inset-bottom) + 48px));
  width: 176px;
  height: 176px;
  pointer-events: auto;
  touch-action: none;
}

.mobile-joystick-ring,
.mobile-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.mobile-joystick-ring {
  width: 136px;
  height: 136px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04) 54%, rgba(0, 0, 0, 0.22));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 0 18px rgba(255, 255, 255, 0.08);
}

.mobile-joystick-knob {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background: rgba(248, 239, 218, 0.76);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.34);
}

.mobile-actions {
  position: absolute;
  right: max(30px, calc(env(safe-area-inset-right) + 30px));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 50px);
  align-items: end;
  justify-content: center;
  gap: 7px 8px;
  pointer-events: auto;
  touch-action: none;
}

.mobile-system-actions {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: auto;
  right: max(112px, calc(env(safe-area-inset-right) + 112px));
  display: flex;
  gap: 7px;
  pointer-events: auto;
  touch-action: none;
}

.mobile-system-action {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(17, 19, 28, 0.66);
  color: rgba(255, 255, 255, 0.88);
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26);
}

.mobile-action {
  position: relative;
  --mobile-action-x: 0px;
  --mobile-action-y: 0px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-family: "NEXON Warhaven", "Pretendard", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  overflow: visible;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24), inset 0 0 12px rgba(255, 255, 255, 0.04);
  transform: translate(var(--mobile-action-x), var(--mobile-action-y));
  touch-action: none;
}

.mobile-action img {
  width: 54%;
  height: 54%;
  object-fit: contain;
  filter: brightness(12) saturate(0);
  pointer-events: none;
}

.mobile-action span {
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  z-index: 2;
  width: max-content;
  max-width: 70px;
  color: #fff;
  font-size: 8px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.92);
  pointer-events: none;
}

.mobile-action:active {
  transform: translate(var(--mobile-action-x), calc(var(--mobile-action-y) + 1px)) scale(0.96);
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.96);
}

.mobile-action.locked {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(255, 255, 255, 0.5);
}

.mobile-action.locked img {
  opacity: 0.46;
  filter: grayscale(1) brightness(0.58) saturate(0);
}

.mobile-action.locked span {
  color: rgba(255, 255, 255, 0.62);
}

.mobile-action.on-cooldown:not(.locked) {
  opacity: 0.68;
}

.mobile-action--skill[data-mobile-action="q"] {
  grid-column: 1;
  grid-row: 1;
  --mobile-action-x: 28px;
  --mobile-action-y: -22px;
}

.mobile-action--skill[data-mobile-action="w"] {
  grid-column: 2;
  grid-row: 1;
  --mobile-action-x: 28px;
  --mobile-action-y: -22px;
}

.mobile-action--skill[data-mobile-action="e"] {
  grid-column: 1;
  grid-row: 2;
}

.mobile-action--ult {
  grid-column: 2;
  grid-row: 2;
  color: #ffe19a;
}

.mobile-action--dash {
  grid-column: 3;
  grid-row: 3;
  --mobile-action-x: -46px;
  width: 42px;
  height: 42px;
  font-size: 11px;
}

.mobile-action--jump {
  grid-column: 2;
  grid-row: 3;
  --mobile-action-x: -46px;
  width: 42px;
  height: 42px;
  font-size: 11px;
}

.mobile-action--potion {
  grid-column: 1;
  grid-row: 3;
  --mobile-action-x: -46px;
  width: 42px;
  height: 42px;
  font-size: 11px;
}

body.mobile-controls-enabled #skill-ui {
  display: none;
}

body.mobile-controls-enabled #potion-slot {
  display: none;
}

body.mobile-controls-enabled #rune-ui {
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 330px);
}

body.mobile-controls-enabled #rune-ui .rune-slots {
  grid-template-columns: repeat(5, 50px);
  grid-auto-rows: 62px;
  gap: 5px 7px;
}

body.mobile-controls-enabled #rune-ui .rune-slot,
body.mobile-controls-enabled #rune-ui .rune-slot--len-1,
body.mobile-controls-enabled #rune-ui .rune-slot--len-2,
body.mobile-controls-enabled #rune-ui .rune-slot--len-3 {
  width: 50px;
  height: 62px;
}

body.mobile-controls-enabled #rune-ui .rune-slot::before {
  left: 5px;
  top: 2px;
  width: 40px;
  height: 40px;
}

body.mobile-controls-enabled #rune-ui .rune-slot-stone {
  top: 4px;
  left: 6px;
  right: 6px;
  bottom: 20px;
}

body.mobile-controls-enabled #rune-ui .rune-slot-symbol,
body.mobile-controls-enabled #rune-ui .rune-slot--len-3 .rune-slot-symbol {
  top: 28px;
  font-size: 8px;
}

body.mobile-controls-enabled #rune-ui .rune-slot-name {
  bottom: 0;
  font-size: 8px;
}

body.mobile-controls-enabled #rune-ui .rune-word-chip {
  font-size: 9px;
}

body.mobile-portrait #mobile-rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.74);
  color: #fff;
  text-align: center;
}

.mobile-rotate-panel {
  display: grid;
  gap: 10px;
  width: min(320px, 100%);
  padding: 24px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(18, 20, 30, 0.9);
}

.mobile-rotate-panel strong {
  font-size: 20px;
}

.mobile-rotate-panel span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  line-height: 1.45;
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
  body.mobile-controls-enabled #ui {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
  }

  body.mobile-controls-enabled #party-ui {
    top: 50%;
    right: max(10px, env(safe-area-inset-right));
    transform: translateY(-50%);
  }

  body.mobile-controls-enabled #bottom-bars {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 12px;
    min-height: 0;
    transform: none;
  }
}

@media (pointer: coarse) and (max-height: 620px),
       (pointer: coarse) and (max-width: 760px) {
  #start-screen .party-pick-card {
    flex: 1 1 0;
    width: auto;
    max-width: 112px;
    min-height: 112px;
  }

  #start-screen .party-pick-illust,
  #start-screen .party-pick-illust-frame {
    flex-basis: 74px;
    width: 70px;
    height: 70px;
  }

  #start-screen .party-pick-illust-frame {
    max-width: 70px;
    overflow: hidden;
    border-radius: 50%;
  }

  #start-screen .party-pick-illust-frame img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center top;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  #start-screen {
    overflow: hidden;
  }

  #start-screen .start-panel {
    transform: scale(0.9);
    transform-origin: center;
  }

  #ui {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
  }

  #stats {
    gap: 10px;
    font-size: 11px;
    line-height: 1.15;
  }

  #party-ui {
    top: 50%;
    right: max(8px, env(safe-area-inset-right));
    transform: translateY(-50%);
  }

  #party-list {
    flex-direction: column;
    gap: 7px;
  }

  .party-member {
    width: 48px;
    height: 48px;
  }

  .party-member-key {
    width: 13px;
    height: 13px;
    font-size: 8px;
  }

  #time-scale-toggle,
  #mute-toggle {
    width: 42px;
    height: 42px;
    left: auto;
    bottom: auto;
    top: max(8px, env(safe-area-inset-top));
  }

  #time-scale-toggle {
    right: max(58px, calc(env(safe-area-inset-right) + 58px));
  }

  #mute-toggle {
    right: max(10px, calc(env(safe-area-inset-right) + 10px));
  }

  .hud-icon {
    width: 20px;
    height: 20px;
  }

  .hud-icon-badge {
    right: -3px;
    bottom: -3px;
    min-width: 17px;
    height: 17px;
    font-size: 9px;
    line-height: 17px;
  }

  #bottom-bars {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 12px;
    min-height: 0;
    transform: none;
  }

  #bottom-bars .bottom-bar-top {
    inset: 0 10px;
    font-size: 9px;
    line-height: 12px;
  }

  body.mobile-controls-enabled #rune-ui {
    left: 50%;
    bottom: max(4px, env(safe-area-inset-bottom));
    max-width: min(270px, calc(100vw - 390px));
    transform: translateX(-50%) scale(0.7);
    transform-origin: bottom center;
  }

  body.mobile-controls-enabled #rune-ui .rune-slots {
    grid-template-columns: repeat(5, 40px);
    grid-auto-rows: 52px;
    gap: 3px 5px;
  }

  body.mobile-controls-enabled #rune-ui .rune-slot,
  body.mobile-controls-enabled #rune-ui .rune-slot--len-1,
  body.mobile-controls-enabled #rune-ui .rune-slot--len-2,
  body.mobile-controls-enabled #rune-ui .rune-slot--len-3 {
    width: 40px;
    height: 52px;
  }

  body.mobile-controls-enabled #rune-ui .rune-slot-name {
    font-size: 6px;
  }

  body.mobile-controls-enabled #rune-ui .rune-word-list {
    gap: 3px;
  }

  body.mobile-controls-enabled #rune-ui .rune-word-chip {
    padding: 2px 5px;
    font-size: 8px;
  }

  .mobile-joystick {
    left: max(34px, calc(env(safe-area-inset-left) + 34px));
    bottom: max(36px, calc(env(safe-area-inset-bottom) + 36px));
    width: 150px;
    height: 150px;
  }

  .mobile-joystick-ring {
    width: 124px;
    height: 124px;
  }

  .mobile-joystick-knob {
    width: 50px;
    height: 50px;
  }

  .mobile-actions {
    right: max(34px, calc(env(safe-area-inset-right) + 34px));
    bottom: max(12px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 42px);
    gap: 6px 7px;
  }

  .mobile-action {
    width: 50px;
    height: 50px;
    font-size: 11px;
  }

  .mobile-action--skill[data-mobile-action="q"] {
    grid-column: 1;
    grid-row: 1;
    --mobile-action-x: 22px;
    --mobile-action-y: -18px;
  }

  .mobile-action--skill[data-mobile-action="w"] {
    grid-column: 2;
    grid-row: 1;
    --mobile-action-x: 22px;
    --mobile-action-y: -18px;
  }

  .mobile-action--skill[data-mobile-action="e"] {
    grid-column: 1;
    grid-row: 2;
  }

  .mobile-action--ult {
    grid-column: 2;
    grid-row: 2;
  }

  .mobile-action--dash {
    grid-column: 3;
    grid-row: 3;
    --mobile-action-x: -34px;
  }

  .mobile-action--jump {
    grid-column: 2;
    grid-row: 3;
    --mobile-action-x: -34px;
  }

  .mobile-action--potion {
    grid-column: 1;
    grid-row: 3;
    --mobile-action-x: -34px;
  }

  .mobile-action--dash,
  .mobile-action--jump,
  .mobile-action--potion {
    width: 36px;
    height: 36px;
    font-size: 9px;
  }

  .mobile-action span {
    bottom: -10px;
    max-width: 58px;
    font-size: 7px;
  }

  .mobile-system-action {
    min-width: 38px;
    height: 30px;
    padding: 0 8px;
    font-size: 10px;
  }

  .mobile-system-actions {
    top: max(8px, env(safe-area-inset-top));
    right: max(106px, calc(env(safe-area-inset-right) + 106px));
    gap: 6px;
  }

  #levelup-overlay {
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .levelup-panel {
    display: flex;
    flex-direction: column;
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100svh - 24px);
    padding: 12px 14px;
    overflow: hidden;
  }

  .levelup-panel h1 {
    flex: 0 0 auto;
    margin-bottom: 7px;
    font-size: 17px;
    line-height: 1.1;
  }

  #upgrade-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: stretch;
    gap: 7px;
    width: 100%;
    max-width: none;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 0 2px 4px;
  }

  .upgrade-option,
  .upgrade-option-awaken {
    flex: none;
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 82px;
    padding: 8px 7px 7px 32px;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    touch-action: manipulation;
  }

  #upgrade-options:has(.upgrade-option-awaken) .upgrade-option {
    flex: none;
    width: auto;
    max-width: none;
  }

  .upgrade-option .key-hint {
    left: 8px;
    top: 8px;
    width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 18px;
  }

  .upgrade-option-icon,
  .upgrade-option-icon-awaken {
    width: 24px;
    height: 24px;
    margin: 0 0 3px;
  }

  .upgrade-option strong {
    font-size: 12px;
    line-height: 1.15;
    width: 100%;
  }

  .upgrade-option span {
    font-size: 10px;
    line-height: 1.22;
    width: 100%;
  }

  .artifact-lv-tag,
  .awaken-tag {
    top: 6px;
    right: 7px;
    max-width: calc(100% - 44px);
    font-size: 9px !important;
    line-height: 1.1;
    text-align: right;
  }

  .artifact-choice-discard {
    flex: 0 0 auto;
    width: min(180px, 52vw);
    height: 32px;
    margin: 7px auto 0;
    font-size: 11px;
  }

  .artifact-choice-discard .key-hint {
    width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 18px;
  }

  #rune-discard-overlay {
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  #rune-discard-overlay .rune-discard-panel {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100svh - 24px);
    padding: 16px;
  }

  #rune-discard-overlay .rune-discard-panel h2 {
    font-size: 17px;
  }

  #rune-discard-overlay .rune-discard-panel p {
    margin-bottom: 8px;
    font-size: 11px;
  }

  #rune-discard-overlay .rune-discard-slots {
    grid-template-columns: repeat(5, 58px);
    gap: 6px;
  }

  #rune-discard-overlay .rune-discard-slot {
    width: 58px;
    min-height: 64px;
    padding: 6px 3px 4px;
  }

  #rune-discard-overlay .rune-discard-slot .rune-slot-meta {
    max-width: 52px;
    font-size: 8px;
  }

  #rune-discard-overlay .rune-discard-actions {
    gap: 6px;
  }

  #rune-discard-overlay .rune-discard-auto,
  #rune-discard-overlay .rune-discard-cancel {
    width: min(136px, 50%);
    padding: 7px 8px;
    font-size: 11px;
  }

  #info-panel,
  #master-ui .master-panel,
  .master-panel,
  .pause-panel,
  .panel {
    width: calc(100vw - 24px);
    max-height: calc(100svh - 24px);
    padding: 16px;
    overflow: auto;
  }

  #info-panel .info-grid,
  #info-panel #info-upgrades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #info-panel .info-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  #info-panel .info-header h2,
  #master-ui .master-header h2,
  #master-ui h2,
  .pause-panel h1,
  .panel h1 {
    font-size: 18px;
  }

  #info-panel .info-section,
  #info-panel #info-upgrades li,
  #master-ui .master-entry,
  #master-ui .master-control-section,
  #master-ui .master-readout {
    padding: 8px;
  }

  #info-panel .info-section dl div,
  #info-panel .info-skill-row,
  #info-panel #info-upgrades li,
  #master-ui .master-entry p,
  #master-ui .master-readout {
    font-size: 11px;
  }

  #master-ui {
    padding: 12px;
  }

  #master-ui .master-tabs {
    gap: 6px;
  }

  #master-ui .master-tabs button,
  #master-ui .master-grid button,
  #master-ui .master-entry-actions button,
  #master-ui .master-close {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 11px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  #start-screen .start-panel {
    width: min(100%, 420px);
    transform: none;
  }

  #start-screen .start-panel h1 {
    font-size: clamp(36px, 12vw, 54px);
    line-height: 1.04;
  }

  .party-roster-row {
    flex-wrap: wrap;
    max-width: 330px;
  }

  #start-screen .party-pick-card {
    flex: 0 0 calc((100% - 12px) / 3);
    max-width: none;
  }
}
