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

html {
  font-size: 16px;
}

html, body {
  height: 100vh;
  overflow: hidden;
}

body {
  background: #f4f2f8;
  color: #2a2a3a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  padding: 0.6rem 1rem;
}

#app {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Top bar ── */
.top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.title-group {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.page-title {
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #2a2a3a;
}
.page-sub {
  font-size: 0.72rem;
  color: #6a6a88;
  letter-spacing: 0.18em;
}
.back-link {
  font-size: 0.63rem;
  color: #6868a0;
  text-decoration: none;
  letter-spacing: 0.14em;
  transition: color 0.2s;
}
.back-link:hover { color: #9b8ec8; }

/* ── Two-column content area ── */
.content-area {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0.7rem;
}

/* ── Left column: garden + arena ── */
.left-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#garden {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #eae8f0;
  border: 1px solid #ccc8d8;
  border-radius: 12px;
  overflow: hidden;
}
#garden::after {
  content: '· · · ✿ · · · · · ✿ · · · · · · ✿ · · · · · ✿ · · · · · · · ✿ · · · · ✿ · · ·';
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  padding: 5px 10px;
  font-size: 0.62rem;
  color: rgba(120,180,160,0.5);
  background: linear-gradient(transparent, rgba(100,160,140,0.12));
  border-top: 1px solid rgba(100,160,140,0.15);
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.6em;
  pointer-events: none;
}

/* ── Garden pets ── */
.gp {
  position: absolute;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  z-index: 2;
  transition: left 1.2s linear, top 1.2s linear;
}
.gp-art {
  display: block;
  line-height: 1.4;
  white-space: pre;
  font-size: 0.58rem;
  font-family: 'Courier New', monospace;
}
.gp.is-mine .gp-art {
  filter: drop-shadow(0 0 4px currentColor);
}
.gp-name {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
  opacity: 0.85;
}
.gp-you {
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  color: #5a5a80;
  opacity: 0.9;
}
.gp-age {
  font-size: 0.48rem;
  letter-spacing: 0.07em;
  color: #5a5a80;
  opacity: 0.9;
}

/* ── Interaction floaters ── */
@keyframes gfloat {
  0%   { opacity: 0;   transform: translate(-50%,-50%) scale(0.5); }
  20%  { opacity: 1;   transform: translate(-50%,-90%) scale(1.3); }
  75%  { opacity: 0.7; transform: translate(-50%,-180%) scale(1); }
  100% { opacity: 0;   transform: translate(-50%,-230%) scale(0.8); }
}
.gi {
  position: absolute;
  font-size: 1rem;
  color: #9b8ec8;
  animation: gfloat 2.2s ease forwards;
  pointer-events: none;
  z-index: 5;
}

/* ── Garden info strip ── */
#garden-info {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: #6a6a88;
  text-align: center;
  flex-shrink: 0;
}

/* ── Arena View ── */
#arena-view {
  flex-shrink: 0;
  background: rgba(192,112,128,0.08);
  border: 1px solid rgba(192,112,128,0.25);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.arena-view-title {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: #c07080;
  text-transform: uppercase;
}
.arena-battle-fighters {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.arena-fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.af-gone {
  font-size: 0.62rem;
  color: #6a6a88;
  letter-spacing: 0.15em;
}
.af-hp-bar-bg {
  width: 80px;
  height: 6px;
  background: #d0cce0;
  border-radius: 3px;
  overflow: hidden;
}
.af-hp-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background-color 0.5s ease;
}
.af-hp-val {
  font-size: 0.5rem;
  color: #5a5a80;
  letter-spacing: 0.06em;
}
.arena-vs {
  font-size: 1.1rem;
  color: #c07080;
  flex-shrink: 0;
}
#arena-battle-log {
  width: 100%;
  max-width: 340px;
  max-height: 70px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(192,112,128,0.3) transparent;
}
.bl-entry {
  font-size: 0.6rem;
  color: #4a4a6a;
  letter-spacing: 0.07em;
  padding: 0.05rem 0;
  text-align: center;
}
.bl-header {
  color: #c07080;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
}
.bl-result {
  color: #d4a574;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}
#arena-waiting {
  font-size: 0.55rem;
  color: #5a5a80;
  letter-spacing: 0.1em;
  text-align: center;
  width: 100%;
}
.arena-waiting-label {
  font-size: 0.62rem;
  color: #6a6a88;
  letter-spacing: 0.18em;
  margin-bottom: 0.3rem;
}
.arena-waiting-pets {
  display: flex;
  gap: 1.8rem;
  justify-content: center;
  flex-wrap: wrap;
}
.arena-waiting-pet {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Right column ── */
.right-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Hatch screen ── */
#hatch-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#egg-art {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #9b8ec8;
  text-shadow: 0 0 10px rgba(155,142,200,0.4);
  animation: hatch-pulse 0.9s ease-in-out infinite alternate;
  user-select: none;
  flex-shrink: 0;
}
@keyframes hatch-pulse {
  from { text-shadow: 0 0 8px rgba(155,142,200,0.3); transform: scale(1); }
  to   { text-shadow: 0 0 20px rgba(155,142,200,0.5); transform: scale(1.05); }
}
.hatch-msg {
  font-size: 0.75rem;
  color: #5a5a80;
  letter-spacing: 0.18em;
  flex-shrink: 0;
}
#hatch-btn {
  padding: 0.55rem 2rem;
  background: linear-gradient(135deg, #7b6eaa, #9b8ec8);
  border: none;
  border-radius: 6px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(123,110,170,0.4);
  transition: all 0.2s;
  flex-shrink: 0;
}
#hatch-btn:hover {
  box-shadow: 0 4px 16px rgba(123,110,170,0.5);
  transform: translateY(-2px);
}

/* ── Pet history ── */
#pet-history {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ph-header {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: #5a5a80;
  text-align: center;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  flex-shrink: 0;
}
.ph-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(155,142,200,0.3) transparent;
}
.ph-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  row-gap: 0.1rem;
  background: #edeaf4;
  border: 1px solid #d0cce0;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  flex-shrink: 0;
}
.ph-name {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: bold;
  grid-column: 1;
  grid-row: 1;
}
.ph-cause {
  font-size: 0.55rem;
  color: #5a5a80;
  letter-spacing: 0.1em;
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  align-self: center;
}
.ph-details {
  font-size: 0.62rem;
  color: #6a6a88;
  letter-spacing: 0.08em;
  grid-column: 1 / -1;
  grid-row: 2;
}
.ph-cause-released { color: #60a5fa; }
.ph-cause-energy   { color: #f87171; }

/* ── Main screen ── */
#main-screen {
  display: none;
  flex-direction: column;
  gap: 0.38rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Pet header ── */
#pet-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
#pet-name {
  font-size: 1.2rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
#element-badge {
  font-size: 1.2rem;
  line-height: 1;
}
#mood-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.75;
  flex-shrink: 0;
}

/* ── Attr chips ── */
#pet-attrs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.attr-chip {
  padding: 0.12rem 0.45rem;
  border: 1px solid #c0bcd0;
  border-radius: 20px;
  font-size: 0.57rem;
  letter-spacing: 0.1em;
  color: #5a5a80;
  background: #e8e5f2;
  text-transform: uppercase;
}

/* ── Stats ── */
#stats {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stat-row {
  display: grid;
  grid-template-columns: 72px 1fr 32px;
  align-items: center;
  gap: 0.4rem;
}
.stat-label {
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a5a80;
  text-align: right;
}
.stat-bar-bg {
  height: 6px;
  background: #d0cce0;
  border-radius: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease, background-color 0.6s ease;
}
.stat-val {
  font-size: 0.6rem;
  color: #5a5a80;
  text-align: left;
}

/* ── Attributes ── */
#attributes {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
#attr-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.attr-section-title {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: #6a6a88;
  text-transform: uppercase;
  flex: 1;
}
#attr-points-badge {
  font-size: 0.55rem;
  color: #d4a574;
  letter-spacing: 0.1em;
  font-weight: bold;
}
#btn-attr-reset {
  padding: 0.12rem 0.4rem;
  background: transparent;
  border: 1px solid rgba(192,112,128,0.3);
  border-radius: 3px;
  color: #c07080;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
  opacity: 0.7;
}
#btn-attr-reset:hover:not(:disabled) { opacity: 1; background: rgba(192,112,128,0.1); }
#btn-attr-reset:disabled { opacity: 0.25; cursor: not-allowed; }
#attr-rows {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.attr-row {
  display: grid;
  grid-template-columns: 72px 1fr 22px 22px;
  align-items: center;
  gap: 0.35rem;
}
.attr-name {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: #5a5a80;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attr-bar-bg {
  height: 5px;
  background: #d0cce0;
  border-radius: 4px;
  overflow: hidden;
}
.attr-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.attr-val {
  font-size: 0.58rem;
  color: #5a5a80;
  text-align: center;
}
.attr-plus-btn {
  padding: 0;
  width: 18px;
  height: 18px;
  background: transparent;
  border: 1px solid rgba(155,142,200,0.4);
  border-radius: 3px;
  color: #9b8ec8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.attr-plus-btn:hover:not(:disabled) { background: rgba(155,142,200,0.15); }
.attr-plus-btn:disabled { opacity: 0.2; cursor: not-allowed; }

/* ── Action buttons ── */
#actions {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.action-btn {
  padding: 0.55rem 0.4rem;
  background: #7b6eaa;
  border: 1px solid #6a5d99;
  border-radius: 6px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  box-shadow: 0 1px 4px rgba(123,110,170,0.3);
}
.action-btn:hover:not(:disabled) {
  background: #8b7ebb;
  border-color: #9b8ec8;
}
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cd {
  font-size: 0.54rem;
  color: rgba(255,255,255,0.7);
  min-width: 20px;
}

/* ── Moves section ── */
#moves-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid #c0bcd0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  background: rgba(232,229,242,0.7);
}
.moves-header {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: #6a6a88;
  text-align: center;
  text-transform: uppercase;
}
#moves-slots {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.move-slot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.4rem;
}
.move-slot-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.move-type-badge {
  font-size: 0.65rem;
  flex-shrink: 0;
}
.move-name {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: #5a5a80;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.move-attr-tag {
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  opacity: 0.85;
  flex-shrink: 0;
}
.move-power {
  font-size: 0.6rem;
  color: #6a6a88;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.move-empty {
  font-size: 0.62rem;
  color: #8a8aa8;
  letter-spacing: 0.1em;
  font-style: italic;
}
.unequip-btn {
  padding: 0.15rem 0.3rem;
  background: transparent;
  border: 1px solid #c0bcd0;
  border-radius: 3px;
  color: #6a6a88;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
}
.unequip-btn:hover { color: #c07080; border-color: rgba(192,112,128,0.4); }
.moves-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.bp-label {
  font-size: 0.55rem;
  color: #d4a574;
  letter-spacing: 0.1em;
}
#btn-skill-shop {
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 1px solid rgba(155,142,200,0.4);
  border-radius: 4px;
  color: #9b8ec8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.53rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
}
#btn-skill-shop:hover {
  background: rgba(155,142,200,0.1);
}

/* ── Skill shop overlay ── */
#skill-shop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(244,242,248,0.98);
  border: 1px solid #c0bcd0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.shop-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem 0.4rem;
  border-bottom: 1px solid #c0bcd0;
}
.shop-title {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #2a2a3a;
}
.shop-bp-info {
  font-size: 0.62rem;
  color: #c4956e;
  letter-spacing: 0.12em;
}
#btn-shop-close {
  background: transparent;
  border: 1px solid #c0bcd0;
  border-radius: 4px;
  color: #6a6a88;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s;
}
#btn-shop-close:hover { background: #e8e5f2; }
#skill-shop-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(155,142,200,0.3) transparent;
}
.shop-type-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.shop-type-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a8aa8;
  padding: 0.12rem 0;
  border-bottom: 1px solid #d0cce0;
  margin-bottom: 0.1rem;
}
.shop-move-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.3rem;
  border-radius: 5px;
  background: #edeaf4;
}
.shop-move-symbol { font-size: 0.7rem; }
.shop-move-info { min-width: 0; }
.shop-move-name {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: #2a2a3a;
  white-space: nowrap;
}
.shop-move-desc {
  font-size: 0.56rem;
  color: #6a6a88;
  letter-spacing: 0.06em;
}
.shop-move-attr-line {
  font-size: 0.55rem;
  color: #6a6a88;
  letter-spacing: 0.05em;
  margin-top: 0.05rem;
}
.shop-move-attr {
  font-weight: bold;
}
.shop-move-pw {
  font-size: 0.55rem;
  color: #6a6a88;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.shop-move-action {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
}
.shop-btn {
  padding: 0.18rem 0.45rem;
  border-radius: 3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
  white-space: nowrap;
}
.shop-btn-learn {
  background: transparent;
  border: 1px solid rgba(196,149,110,0.5);
  color: #c4956e;
}
.shop-btn-learn:hover:not(:disabled) {
  background: rgba(196,149,110,0.1);
}
.shop-btn-learn:disabled { opacity: 0.4; cursor: not-allowed; }
.shop-btn-equip {
  background: transparent;
  border: 1px solid rgba(155,142,200,0.5);
  color: #9b8ec8;
}
.shop-btn-equip:hover { background: rgba(155,142,200,0.1); }
.shop-btn-equipped {
  border: 1px solid rgba(100,200,140,0.4);
  color: #5bbd80;
  background: transparent;
  cursor: default;
}

/* ── Arena controls ── */
#arena-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  border: 1px solid rgba(192,112,128,0.25);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  background: rgba(192,112,128,0.06);
}
.arena-header {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: #c07080;
  text-transform: uppercase;
}
#arena-status {
  font-size: 0.58rem;
  color: #c4956e;
  letter-spacing: 0.1em;
  flex: 1;
  min-width: 80px;
}
#arena-wounds {
  font-size: 0.55rem;
  color: #c4956e;
  letter-spacing: 0.1em;
  width: 100%;
}
#btn-arena-enter, #btn-arena-leave {
  padding: 0.28rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(192,112,128,0.4);
  border-radius: 4px;
  color: #c07080;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.57rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
}
#btn-arena-enter:hover:not(:disabled), #btn-arena-leave:hover:not(:disabled) {
  background: rgba(192,112,128,0.1);
}
#btn-arena-enter:disabled, #btn-arena-leave:disabled { opacity: 0.4; cursor: not-allowed; }
.arena-note {
  font-size: 0.56rem;
  color: #8a8aa8;
  letter-spacing: 0.1em;
  width: 100%;
}

/* ── Dungeon section (entry controls) ── */
#dungeon-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  border: 1px solid rgba(139, 168, 128, 0.25);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  background: rgba(139, 168, 128, 0.06);
}
.dungeon-header {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: #8ba880;
  text-transform: uppercase;
}
#dungeon-status {
  font-size: 0.58rem;
  color: #c4956e;
  letter-spacing: 0.1em;
  flex: 1;
  min-width: 80px;
}
#btn-dungeon-enter {
  padding: 0.28rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(139, 168, 128, 0.4);
  border-radius: 4px;
  color: #8ba880;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.57rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
}
#btn-dungeon-enter:hover:not(:disabled) { background: rgba(139, 168, 128, 0.1); }
#btn-dungeon-enter:disabled { opacity: 0.4; cursor: not-allowed; }
.dungeon-note {
  font-size: 0.56rem;
  color: #8a8aa8;
  letter-spacing: 0.1em;
  width: 100%;
}

/* ── Dungeon overlay ── */
#dungeon-overlay {
  position: absolute;
  inset: 0;
  background: rgba(244, 242, 248, 0.98);
  border: 1px solid rgba(139, 168, 128, 0.5);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.dungeon-overlay-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem 0.4rem;
  border-bottom: 1px solid rgba(139, 168, 128, 0.35);
}
.dungeon-overlay-title {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8ba880;
}
#btn-dungeon-leave {
  background: transparent;
  border: 1px solid rgba(192, 112, 128, 0.4);
  border-radius: 4px;
  color: #c07080;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.57rem;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s;
}
#btn-dungeon-leave:hover { background: rgba(192, 112, 128, 0.1); }

#dungeon-room-container {
  flex-shrink: 0;
  padding: 0.55rem 0.8rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
#dungeon-room-name {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #2a2a3a;
}
#dungeon-room-type {
  font-size: 0.54rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6a6a88;
}
#dungeon-room-desc {
  font-size: 0.63rem;
  color: #5a5a80;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
#dungeon-event {
  font-size: 0.58rem;
  color: #7a7a9a;
  letter-spacing: 0.05em;
  font-style: italic;
}

/* ── Dungeon minimap ── */
#dungeon-map {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.6rem;
  overflow: auto;
  border-top: 1px solid rgba(139, 168, 128, 0.25);
  border-bottom: 1px solid rgba(139, 168, 128, 0.25);
}
#dungeon-map pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.62rem;
  line-height: 1.35;
  color: #8ba880;
  white-space: pre;
  user-select: none;
  margin: 0;
}

/* ── Dungeon exits ── */
#dungeon-exits {
  flex-shrink: 0;
  display: grid;
  grid-template-areas:
    ". n ."
    "w . e"
    ". s .";
  grid-template-columns: 1fr 1.2fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.22rem;
  padding: 0.4rem 0.8rem 0.35rem;
  max-width: 260px;
  margin: 0 auto;
  width: 100%;
}
.dungeon-exit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.35rem 0.25rem;
  background: rgba(232, 229, 242, 0.9);
  border: 1px solid rgba(139, 168, 128, 0.3);
  border-radius: 5px;
  color: #8ba880;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
  line-height: 1.3;
}
.dungeon-exit-btn:hover { background: rgba(139, 168, 128, 0.2); border-color: #8ba880; }
.dungeon-exit-btn.dir-n { grid-area: n; }
.dungeon-exit-btn.dir-s { grid-area: s; }
.dungeon-exit-btn.dir-e { grid-area: e; }
.dungeon-exit-btn.dir-w { grid-area: w; }
.exit-label {
  font-size: 0.48rem;
  color: #6868a0;
  letter-spacing: 0.05em;
  text-transform: none;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#dungeon-room-count {
  flex-shrink: 0;
  text-align: center;
  padding: 0.15rem 0 0.35rem;
  font-size: 0.54rem;
  color: #6868a0;
  letter-spacing: 0.1em;
}

/* ── Bottom row ── */
#bottom-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
#age-display {
  font-size: 0.58rem;
  color: #7878a0;
  letter-spacing: 0.1em;
}
#btn-release {
  padding: 0.28rem 0.85rem;
  background: transparent;
  border: 1px solid rgba(192,112,128,0.4);
  border-radius: 4px;
  color: #c07080;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.57rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}
#btn-release:hover { opacity: 1; }

/* ── Pet activity log ── */
#pet-log-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.log-header {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: #8a8aa8;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}
#pet-log {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(155,142,200,0.2) transparent;
}
.log-entry {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-shrink: 0;
}
.log-time {
  font-size: 0.55rem;
  color: #7a7a9a;
  min-width: 42px;
  text-align: right;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.log-text {
  font-size: 0.55rem;
  color: #a0a0b8;
  letter-spacing: 0.07em;
}

/* ── Reaction (action feedback) ── */
@keyframes float-up {
  from { opacity:1; transform: translate(-50%,-50%); }
  to   { opacity:0; transform: translate(-50%,-200%); }
}
.reaction {
  position: fixed;
  font-size: 1.4rem;
  pointer-events: none;
  animation: float-up 1.1s ease forwards;
  z-index: 200;
}

/* ── Notification ── */
#notif {
  position: fixed;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(255,255,255,0.97);
  border: 1px solid #c0bcd0;
  border-radius: 6px;
  padding: 0.4rem 1.1rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #2a2a3a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: transform 0.3s ease;
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
}
#notif.show { transform: translateX(-50%) translateY(0); }
