/* ===================================
   pen pen English — Kirby Air Rider Theme
   Sky blue + diagonal stripes + red/yellow
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600;700;800;900&family=Noto+Sans+JP:wght@400;500;700;900&family=Outfit:wght@400;600;700;900&display=swap');

/* ---- Design Tokens ---- */
@keyframes low-hp-pulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #FFD700); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 10px #FFD700) brightness(1.3); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px #FFD700); }
}
.low-hp-glow {
  animation: low-hp-pulse 0.8s infinite ease-in-out;
  color: #FFD700 !important;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}
:root {
  /* Kirby Air Rider palette */
  --sky-blue:    #00A8E8;
  --sky-mid:     #0090CC;
  --sky-dark:    #006EA8;
  --sky-light:   #C5ECFC;

  --card-dark:   #1A1A24;
  --card-stripe: #1E1E2C;
  --panel-white: #FFFFFF;
  --panel-light: #F0F8FF;
  --panel-border:#D0E8F8;

  --red:         #E8003C;
  --red-dark:    #B8002E;
  --yellow:      #FFD700;
  --yellow-dark: #E0B800;
  --yellow-light:#FFF5CC;

  --text-dark:   #111118;
  --text-mid:    #444458;
  --text-light:  #FFFFFF;
  --text-dim:    rgba(255,255,255,0.55);

  --font-game: 'Exo 2', sans-serif;
  --font-ja:   'Noto Sans JP', sans-serif;
  --font-en:   'Outfit', sans-serif;

  --shadow-card: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-deep: 0 8px 40px rgba(0,0,0,0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  font-family: var(--font-ja);
  background: var(--sky-blue);
  color: var(--text-dark);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---- App Root ---- */
#app {
  width: 100vw; height: 100vh;
  position: relative; overflow: hidden;
  /* Soft Spring Sky Blue background */
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0),
      rgba(255,255,255,0) 20px,
      rgba(255,255,255,0.1) 20px,
      rgba(255,255,255,0.1) 40px
    ),
    linear-gradient(160deg, #8ED6FF 0%, #5EB4F0 50%, #3095E0 100%);
}

/* ---- Screen System ---- */
.screen {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 20px 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ---- Card base ---- */
/* Dark striped cards (Air Rider style) */
.card-dark {
  background:
    repeating-linear-gradient(
      -45deg,
      var(--card-dark),
      var(--card-dark) 10px,
      var(--card-stripe) 10px,
      var(--card-stripe) 20px
    );
  border-radius: var(--radius-lg);
  border: 3px solid var(--yellow);
  position: relative;
}

/* White panel cards */
.card {
  background: var(--panel-white);
  border-radius: var(--radius-lg);
  border: 2px solid var(--panel-border);
  box-shadow: var(--shadow-card);
  padding: 20px;
  width: 100%; max-width: 720px;
  position: relative; overflow: hidden;
}

/* Corner bracket decoration */
.corner-bracket::before,
.corner-bracket::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--yellow);
  border-style: solid;
}
.corner-bracket::before {
  top: 6px; left: 6px;
  border-width: 3px 0 0 3px;
}
.corner-bracket::after {
  bottom: 6px; right: 6px;
  border-width: 0 3px 3px 0;
}

/* Arrow badge on card (like Air Rider's ▶ corner) */
.card-arrow-badge {
  position: absolute; bottom: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 28px 28px;
  border-color: transparent transparent var(--yellow) transparent;
}
.card-arrow-badge::after {
  content: '▶';
  position: absolute; bottom: -24px; left: -16px;
  font-size: 9px; color: var(--card-dark); font-weight: 900;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: none; border-radius: var(--radius-md);
  cursor: pointer; font-family: var(--font-game);
  font-weight: 800; transition: all 0.1s ease;
  text-decoration: none; position: relative; overflow: hidden;
  text-transform: uppercase; letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.94) translateY(2px); }

.btn-primary {
  background: var(--red);
  color: white; font-size: 18px; padding: 16px 36px;
  border: 3px solid rgba(255,255,255,0.3);
  box-shadow: 0 5px 0 var(--red-dark), var(--shadow-card);
  min-width: 220px;
}
.btn-primary:active { box-shadow: 0 2px 0 var(--red-dark); transform: translateY(3px); }

.btn-yellow {
  background: var(--yellow);
  color: var(--text-dark); font-size: 18px; padding: 16px 36px;
  border: 3px solid rgba(0,0,0,0.15);
  box-shadow: 0 5px 0 var(--yellow-dark), var(--shadow-card);
  min-width: 220px;
}
.btn-yellow:active { box-shadow: 0 2px 0 var(--yellow-dark); transform: translateY(3px); }

.btn-blue {
  background: var(--sky-dark);
  color: white; font-size: 18px; padding: 16px 36px;
  border: 3px solid rgba(255,255,255,0.2);
  box-shadow: 0 5px 0 #005080, var(--shadow-card);
  min-width: 220px;
}
.btn-blue:active { box-shadow: 0 2px 0 #005080; transform: translateY(3px); }

.btn-ghost {
  background: rgba(255,255,255,0.2);
  color: white; font-size: 15px; padding: 12px 24px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  letter-spacing: 0.02em; text-transform: none;
  font-family: var(--font-ja); font-weight: 700;
  backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.3); }

/* ---- Animations ---- */
@keyframes bounceIn {
  0% { transform: scale(0.4) rotate(-5deg); opacity: 0; }
  55% { transform: scale(1.1) rotate(2deg); opacity: 1; }
  80% { transform: scale(0.97); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px); }
  30% { transform: translateX(9px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
@keyframes slideUp {
  from { transform: translateY(22px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}
@keyframes floatUp {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-70px) scale(1.2); opacity: 0; }
}
@keyframes confettiSpin {
  from { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  to   { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}
@keyframes stampGame {
  0%   { transform: scale(4) rotate(20deg); opacity: 0; }
  55%  { transform: scale(0.9) rotate(-3deg); opacity: 1; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes stripeShift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

.animate-bounceIn { animation: bounceIn 0.45s ease forwards; }

.icon-coin {
  display: inline-block; width: 1.4em; height: 1.4em;
  background: url('../assets/images/items/jewels/Jewel_lv0.png') center/contain no-repeat;
  vertical-align: middle; margin-right: 2px;
}
.icon-pearl {
  display: inline-block; width: 1.4em; height: 1.4em;
  background: url('../assets/images/items/jewels/Jewel_lv1.png') center/contain no-repeat;
  vertical-align: middle; margin-right: 2px;
}
.icon-ruby {
  display: inline-block; width: 1.4em; height: 1.4em;
  background: url('../assets/images/items/jewels/Jewel_lv2.png') center/contain no-repeat;
  vertical-align: middle; margin-right: 2px;
}
.animate-shake    { animation: shake 0.45s ease; }
.animate-slideUp  { animation: slideUp 0.3s ease forwards; }
.animate-fadeIn   { animation: fadeIn 0.3s ease forwards; }

/* ---- Utilities ---- */
.text-game { font-family: var(--font-game); }
.text-ja   { font-family: var(--font-ja); }
.hidden    { display: none !important; }
.flex-col  { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 4px; }

/* ---- Safe area ---- */
.safe-top { padding-top: max(20px, env(safe-area-inset-top)); }

/* ---- Section label ---- */
.section-label {
  font-family: var(--font-game); font-size: 11px; font-weight: 800;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--yellow-light); background: var(--red);
  padding: 4px 14px; border-radius: 4px;
  display: inline-block;
}

/* iPad responsive */
@media (min-width: 768px) {
  .screen { padding: 28px 36px; }
  .btn-primary, .btn-yellow, .btn-blue { font-size: 20px; padding: 18px 44px; }
}
@media (min-width: 1024px) {
  .screen { padding: 32px 52px; }
}

@media (max-width: 480px) {
  .gh-stat-box {
    display: none !important;
  }
}

/* ============================================================
   GLOBAL HEADER
============================================================ */
.global-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  padding: 0;
  pointer-events: all;
}

.global-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  height: auto;
  pointer-events: none; /* Let clicks pass through empty areas */
}

/* Left: avatar + name stack */
.gh-left {
  display: flex; align-items: center; padding: 10px 16px 10px 12px; min-width: 0; flex-shrink: 0; position: relative; cursor: pointer;
  pointer-events: all;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.7) 100%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-radius: 0 0 24px 0;
  border-right: 1px solid rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  transition: background 0.2s, box-shadow 0.2s;
}
.gh-left:hover {
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 100%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.05);
}
.gh-left:active {
  background: rgba(240, 240, 240, 0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.gh-left:hover .gh-avatar {
  transform: scale(1.05);
}

@media (max-width: 767px) {
  .gh-left {
    display: none !important;
  }
}

/* Profile section inside Global Header */
#global-header-profile {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  z-index: 1000; /* Ensure avatar sits above title if it overlaps, but padding should prevent it */
}

/* Character info block */
#global-header-profile .header-char-info {
  margin-left: 64px; /* Space for the absolute avatar */
  display: flex;
  flex-direction: column;
}
.gh-avatar-wrap {
  display: flex; align-items: center; justify-content: center; height: 100%;
}
.gh-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid #EBE4D5;
  background: #fff;
  z-index: 2;
  box-shadow: 1px 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
  margin-left: 4px;
}
.gh-name-block {
  display: flex; flex-direction: column; justify-content: center; min-width: 0; margin-left: 12px;
}
.gh-name {
  font-family: var(--font-ja); color: #4A3C31; font-size: 16px; font-weight: 900;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.gh-level {
  font-family: var(--font-game); color: #8C7A6B; font-size: 11px; font-weight: 800;
  line-height: 1; margin-bottom: 2px;
}

/* Center: Stats */
.gh-center {
  display: none;
}

/* Right: nav buttons (Glassmorphism Tab) */
.gh-right-nav {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 44px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.7) 100%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-radius: 0 0 16px 16px;
  border-left: 1px solid rgba(255,255,255,0.6);
  border-right: 1px solid rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  cursor: pointer;
  pointer-events: all;
  transition: background 0.2s, box-shadow 0.2s;
  color: #555;
  margin-right: 16px;
}
.gh-right-nav:hover {
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.85) 100%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.05);
}
.gh-right-nav:active {
  background: rgba(240, 240, 240, 0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}


/* Push all screens down to avoid being covered by the header */
body.has-header .screen {
  padding-top: max(16px, env(safe-area-inset-top));
}

/* ============================================================
   HEADER MODAL MENU ITEMS
============================================================ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hdr-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(157, 117, 75, 0.25);
  cursor: pointer;
  transition: background 0.12s;
  background: transparent;
}
.hdr-menu-item:active,
.hdr-menu-item:hover {
  background: rgba(157, 117, 75, 0.12);
}
.hdr-menu-item--last {
  border-bottom: none;
}
.hdr-menu-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}
.hdr-menu-label {
  flex: 1;
  font-family: var(--font-ja);
  font-size: 15px;
  font-weight: 900;
  color: #5C3A21;
  letter-spacing: 0.02em;
}
.hdr-menu-arrow {
  font-size: 12px;
  color: #9D754B;
  font-weight: 700;
}

/* Flat sub-buttons in header menu */
.hdr-flat-btn {
  display: block;
  width: 100%;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid #D4C4A8;
  border-radius: 8px;
  font-family: var(--font-ja);
  font-size: 14px;
  font-weight: 700;
  color: #5C3A21;
  text-align: center;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.1s ease;
}
.hdr-flat-btn:hover,
.hdr-flat-btn:active {
  background: #FFF;
  border-color: #BFA281;
  transform: scale(0.98);
}
/* Avatar hover effect */
.hdr-avatar-btn {
  transition: transform 0.15s, box-shadow 0.15s;
}
.hdr-avatar-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.hdr-avatar-btn:active {
  transform: scale(0.95);
}

