/* Bear Trap Planner — scoped for K1392 site */
.page-bear {
  --gold: var(--accent);
  --gold-light: var(--accent-hover);
  --gold-dim: var(--accent-dim);
  --blood-bright: var(--error);
  --dark: var(--bg-dark);
  --dark2: var(--bg-card);
  --dark3: #252a38;
  --parchment: var(--text-muted);
  --infantry: #4a9eca;
  --cavalry: #c47f2a;
  --archer: #5ba85b;
  --t10: var(--accent-hover);
  --t9: var(--text-muted);
}

.page-bear {
  overflow-x: hidden;
}

.bear-app,
.bear-app * {
  box-sizing: border-box;
}

.bear-app * {
  margin: 0;
  padding: 0;
}

.page-bear::before,
.page-bear .particles,
.page-bear #sparkle-container {
  display: none !important;
}

.bear-app {
  font-family: inherit;
  color: var(--text);
  max-width: 820px;
  margin: 0 auto;
  padding: 0 0 2rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 1100px) {
  .bear-app { max-width: 1080px; }
}

@media (min-width: 1400px) {
  .bear-app { max-width: 1240px; }
}

.bear-app .bear-toolbar {
  text-align: center;
  padding: 0.5rem 0 0.75rem;
}

.bear-app .page-title {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin: 0.5rem 0 0.25rem;
}

.bear-app .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.bear-app .lang-btn,
.bear-app .planner-tab,
.bear-app .preset-btn,
.bear-app .toggle-btn {
  font-family: inherit;
}

.bear-app .lang-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 6px;
}

.bear-app .lang-btn.active,
.bear-app .toggle-btn.active {
  background: rgba(201, 162, 39, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.bear-app .planner-tabs {
  border-color: var(--border);
}

.bear-app .planner-tab.active {
  background: rgba(201, 162, 39, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.bear-app .calc-btn,
.bear-app .alliance-sticky-generate {
  border-radius: 6px;
  font-family: inherit;
}

  /* PARTICLES */
  .particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
  .particle {
    position: absolute;
    width: 3px; height: 3px;
    background: var(--gold-light);
    border-radius: 50%;
    opacity: 0;
    animation: float-up linear infinite;
  }
  @keyframes float-up {
    0% { transform: translateY(100vh) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translateY(50vh) translateX(20px) rotate(180deg); }
    90% { opacity: 0.4; }
    100% { transform: translateY(-20px) translateX(-20px) rotate(360deg); opacity: 0; }
  }
  @keyframes float-up-2 {
    0% { transform: translateY(100vh) translateX(0) scale(1); opacity: 0; }
    15% { opacity: 1; }
    50% { transform: translateY(50vh) translateX(-30px) scale(1.5); }
    85% { opacity: 0.3; }
    100% { transform: translateY(-20px) translateX(40px) scale(0.5); opacity: 0; }
  }

  /* HEADER */
  .bear-app .bear-toolbar { position: relative; }
  .clan-shield { margin: 8px auto 0; }
  /* CLAN LOGO - Bold Royal */
  .clan-name {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    margin: 20px auto 14px;
    line-height: 1;
  }
  /* Crown */
  .clan-crown {
    font-size: 24px;
    margin-bottom: -4px;
    animation: crown-glow 2.5s ease-in-out infinite;
    z-index: 2;
  }
  @keyframes crown-glow {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
  }
  /* xXx — main brand, bold and tight */
  .clan-xxx-wrap {
    position: relative;
    display: flex; align-items: center; gap: 10px;
  }
  .clan-xxx-wrap .side-sword {
    font-size: 18px;
    color: #c9a84c;
    opacity: 0.85;
  }
  .clan-xxx {
    font-family: inherit;
    font-size: 60px; font-weight: 900;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg,
      #ffffff 0%,
      #fff5c0 22%,
      #f0d080 42%,
      #c9a84c 60%,
      #8a6418 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    -webkit-text-stroke: 1px rgba(255,235,150,0.3);
    animation: xxx-pulse 3s ease-in-out infinite;
    display: inline-flex; align-items: baseline;
  }
  .clan-xxx .x-small { font-size: 0.65em; opacity: 0.92; }
  .clan-xxx .x-big   { font-size: 1.25em; margin: 0 -0.04em; }
  @keyframes xxx-pulse {
    0%, 100% { }
    50%      { }
  }
  /* COMMANDERS — big and bold, tight to xXx */
  .clan-commanders {
    font-family: inherit;
    font-size: 28px; font-weight: 900;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg,
      #f0d080 0%,
      #c9a84c 40%,
      #a07830 80%,
      #6a4810 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    line-height: 1;
    margin-top: -8px;
    -webkit-text-stroke: 0.5px rgba(255,235,150,0.25);
  }
  @media (max-width: 480px) {
    .clan-name { margin: 14px auto 10px; }
    .clan-crown { font-size: 20px; }
    .clan-xxx-wrap { gap: 6px; }
    .clan-xxx-wrap .side-sword { font-size: 14px; }
    .clan-xxx { font-size: 46px; }
    .clan-commanders { font-size: 22px; margin-top: -6px; }
  }
  .bear-app .bear-toolbar { text-align: center; }
  .app-title-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 2px 0; }
  .sword-icon { font-size: 18px; color: var(--gold-dim); opacity: 0.8; }
  .app-title {
    font-family: inherit;
    font-size: 13px; font-weight: 700;
    color: var(--gold-dim); letter-spacing: 0.25em;
    text-transform: uppercase;
  }

  .trap-icon {
    font-size: 56px; display: block; margin-bottom: 8px;
    animation: hero-pulse 2.5s ease-in-out infinite;
    transform-origin: center;
  }
  @keyframes hero-pulse {
    0%,100% { transform: scale(1) rotate(-3deg); }
    50% { transform: scale(1.08) rotate(3deg); }
  }

  h1 {
    font-family: inherit;
    font-size: clamp(14px, 4vw, 22px);
    font-weight: 900;
    color: var(--gold-light);
    letter-spacing: 0.08em;
    animation: title-glow 3s ease-in-out infinite alternate;
  }
  @keyframes title-glow {
    from { }
    to   { }
  }

  .subtitle { font-size: 10px; color: var(--gold-dim); letter-spacing: 0.15em; text-transform: uppercase; margin-top: 4px; white-space: nowrap; }

  .divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--gold-dim); font-size: 18px; }
  .divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-dim), transparent); }
  .divider span { animation: divider-pulse 2s ease-in-out infinite alternate; }
  @keyframes divider-pulse { from { } to { } }

  .section-title { font-family: inherit; font-size: 11px; color: var(--gold-light); letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 14px; position: relative; display: inline-block; }

  /* LANGUAGE SWITCHER */
  .lang-bar { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 10px 0 4px; flex-wrap: wrap; }
  .lang-btn {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 20px;
    color: var(--parchment);
    font-family: inherit;
    font-size: 13px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all 0.25s;
  }
  .lang-btn:hover { border-color: rgba(201,168,76,0.5); transform: translateY(-1px); }
  .lang-btn.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.08));
    border-color: var(--gold);
    color: var(--gold-light);
    font-weight: 600;
  }

  /* ARMY EDITOR */
  .army-editor {
    background: linear-gradient(135deg, #0c1828, #122034);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
  }
  .army-editor::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

  .troop-editor-row { display: grid; grid-template-columns: 60px 1fr 1fr 1fr; gap: 6px; align-items: end; margin-bottom: 8px; }
  .troop-editor-row:last-child { margin-bottom: 0; }
  .troop-name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--parchment); text-align: center; }

  .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
  .dot-i { background: var(--infantry); color: var(--infantry); }
  .dot-c { background: var(--cavalry); color: var(--cavalry); }
  .dot-a { background: var(--archer); color: var(--archer); }

  .input-group { display: flex; flex-direction: column; gap: 3px; }
  .input-label { font-size: 10px; color: var(--gold-dim); letter-spacing: 0.1em; text-transform: uppercase; }
  input[type="number"] {
    background: rgba(6,14,26,0.8);
    border: 1.5px solid rgba(201,168,76,0.3);
    border-radius: 8px;
    color: #f0f8ff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 6px;
    width: 100%;
    outline: none;
    transition: all 0.25s;
    -moz-appearance: textfield;
  }
  input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
  input[type="number"]:focus { border-color: var(--gold); background: rgba(0,0,0,0.7); }

  /* SETTINGS */
  .settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
  .setting-box {
    background: linear-gradient(135deg, #0c1828, #122034);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 12px;
    padding: 16px;
  }
  .toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
  /* Compact horizontal padding for marches grid (fits 6 buttons even at high zoom) */
  #marches-toggle-row .toggle-btn,
  #march-tooltips .toggle-btn { padding: 8px 4px; }
  .toggle-btn {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 8px;
    color: var(--parchment);
    font-family: inherit;
    font-size: 15px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .toggle-btn:hover { border-color: rgba(201,168,76,0.5); transform: translateY(-2px); }
  .toggle-btn.active {
    background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,180,0,0.08));
    border-color: var(--gold-light);
    color: var(--gold-light);
    font-weight: 700;
    transform: translateY(-2px);
  }
  .rally-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 4px; }
  .switch { width: 42px; height: 24px; background: rgba(0,0,0,0.5); border: 1px solid rgba(201,168,76,0.2); border-radius: 12px; position: relative; transition: all 0.3s; flex-shrink: 0; }
  .switch::after { content: ''; position: absolute; width: 18px; height: 18px; background: var(--gold-dim); border-radius: 50%; top: 2px; left: 2px; transition: all 0.3s; }
  .switch.on { background: rgba(201,168,76,0.2); border-color: var(--gold); }
  .switch.on::after { left: 21px; background: var(--gold-light); }
  .switch-label { font-size: 14px; color: var(--parchment); transition: color 0.3s; }
  .switch-label.on { color: var(--gold-light); font-weight: 600; }

  /* CALC BUTTON */
  .calc-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(255,215,0,0.12), rgba(80,180,255,0.06));
    border: 1px solid var(--gold);
    border-radius: 10px;
    color: var(--gold-light);
    font-family: inherit;
    font-size: 15px;
    letter-spacing: 0.12em;
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
  }
  .calc-btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
  }
  .calc-btn:hover::before { transform: translateX(100%); }
  .calc-btn:hover {
    background: linear-gradient(135deg, rgba(255,215,0,0.18), rgba(80,180,255,0.12));
    transform: translateY(-3px);
  }
  .calc-btn:active { transform: translateY(0) scale(0.98); }
  .calc-btn { position: relative; overflow: hidden; }
  .calc-btn::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(255,215,0,0.4) 0%, transparent 70%); opacity: 0; transition: opacity 0.3s; }
  .calc-btn:hover::after { opacity: 1; }

  /* RESULTS */
  #results { display: none; }
  #results.show { display: block; }

  /* DONUT CHART */
  .donut-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #0c1828, #122034);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 20px;
    animation: slide-in 0.5s ease-out;
  }
  @keyframes slide-in { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }

  .donut-chart { flex-shrink: 0; }
  .donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
  .legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
  .legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .legend-label { color: var(--parchment); flex: 1; }
  .legend-pct { color: var(--gold-light); font-weight: 600; font-size: 14px; }
  .legend-num { color: var(--gold-dim); font-size: 12px; }
  .donut-total { text-align: center; margin-top: 4px; font-size: 11px; color: var(--gold-dim); letter-spacing: 0.1em; text-transform: uppercase; }

  /* MARCH CARDS */
  .marches-grid { display: grid; gap: 14px; margin-bottom: 20px; }
  @media (max-width: 600px) { .marches-grid { grid-template-columns: 1fr !important; } }

  .march-card {
    background: linear-gradient(160deg, #0c1828, #122034);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 12px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    opacity: 0;
    animation: card-enter 0.5s ease-out forwards;
  }
  .march-card:hover { transform: translateY(-3px); }

  @keyframes card-enter {
    from { opacity: 0; transform: translateY(40px) scale(0.95) rotateX(8deg); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0) scale(1) rotateX(0); filter: blur(0); }
  }

  .march-card::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.6;
  }

  /* RALLY LEADER SPECIAL */
  .rally-leader-card {
    border-color: rgba(201,168,76,0.5);
    background: linear-gradient(160deg, #0a1020, #0e1830);
  }
  .rally-leader-card::after { background: linear-gradient(90deg, transparent, var(--blood-bright), transparent); opacity: 0.8; }
  .rally-leader-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(192,57,43,0.08) 0%, transparent 70%);
    pointer-events: none;
  }

  .march-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
  .march-num {
    font-family: inherit;
    font-size: 10px;
    color: var(--gold-dim);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .march-role { font-size: 16px; font-weight: 600; color: var(--gold-light); }
  .rally-leader-card .march-role { color: #ff8060; }

  /* CROWN ANIMATION */
  .crown-anim {
    display: inline-block;
    animation: crown-bounce 1.5s ease-in-out infinite;
  }
  @keyframes crown-bounce {
    0%,100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-4px) rotate(5deg); }
  }

  .march-total-badge {
    background: rgba(201,168,76,0.12);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    white-space: nowrap;
  }

  /* STRENGTH SCORE */
  .strength-bar-wrap { margin-bottom: 12px; }
  .strength-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 11px; color: var(--gold-dim); text-transform: uppercase; letter-spacing: 0.1em; }
  .strength-score { font-size: 13px; font-weight: 700; }
  .strength-bar-bg { height: 7px; background: rgba(0,0,0,0.6); border-radius: 4px; overflow: hidden; }
  .strength-bar-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }

  /* RATIO BAR */
  .ratio-bar-wrap { margin: 10px 0 14px; }
  .ratio-bar-inner { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; }
  .ratio-seg {
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
    overflow: hidden;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
    min-width: 26px;
  }
  .ratio-seg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
  .ratio-arc { background: linear-gradient(90deg, #2d6e2d, #5ba85b); color: #c0ffc0; border-radius: 4px 0 0 4px; }
  .ratio-cav { background: linear-gradient(90deg, #7a4a10, #c47f2a); color: #ffe0a0; }
  .ratio-inf { background: linear-gradient(90deg, #1a4a7a, #4a9eca); color: #c0e8ff; border-radius: 0 4px 4px 0; }
  .ratio-label { font-size: 11px; color: var(--gold-dim); margin-top: 5px; letter-spacing: 0.05em; }

  /* TROOP BLOCKS */
  .march-troops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  @media (max-width: 600px) {
    .march-troops { gap: 5px; }
    .troop-block { padding: 7px 7px; }
    .troop-block-val { font-size: 14px; }
    .troop-block-tier { font-size: 10px; }
    .troop-block-label { font-size: 9px; }
  }
  /* Medium screens: 3-up march grid creates narrow columns. Tighten the troop blocks aggressively to prevent number truncation. Applies up to 1099px (where container widens). */
  @media (min-width: 601px) and (max-width: 1099px) {
    .march-troops { gap: 3px; }
    .troop-block { padding: 6px 4px; }
    .troop-block-val { font-size: 12px; letter-spacing: -0.04em; }
    .troop-block-tier { font-size: 9px; line-height: 1.4; letter-spacing: -0.02em; }
    .troop-block-label { font-size: 8.5px; letter-spacing: 0.03em; }
    .march-card { padding: 12px; }
    .ratio-seg { font-size: 10px; min-width: 22px; }
    .ratio-seg span { padding: 0 2px; }
    .ratio-label { font-size: 10px; }
    .tier-badge { font-size: 9px; padding: 1px 3px; margin-right: 2px; }
  }
  .troop-block {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 9px 10px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: border-color 0.2s;
    min-width: 0;
    overflow: hidden;
  }
  .troop-block:hover { border-color: rgba(201,168,76,0.2); }
  .troop-block-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold-dim); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; min-width: 0; }
  .troop-block-val { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .troop-block-tier { font-size: 11px; margin-top: 4px; line-height: 1.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* TIER BADGES */
  .tier-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 3px;
    letter-spacing: 0.05em;
  }
  .tier-t10 { background: rgba(240,208,128,0.2); color: var(--t10); border: 1px solid rgba(240,208,128,0.3); }
  .tier-t9  { background: rgba(160,160,176,0.15); color: var(--t9);  border: 1px solid rgba(160,160,176,0.25); }

  .march-tip { margin-top: 10px; font-size: 12px; font-style: italic; color: rgba(212,184,150,0.5); }
  .march-hero-tip {
    margin-top: 8px; padding: 8px 10px;
    background: rgba(201,168,76,0.08);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 6px;
    display: flex; align-items: center; gap: 6px;
    font-size: 12px;
  }
  .march-hero-tip strong { color: var(--gold-light); font-size: 13px; }

  /* ANIMATED COUNTER */
  .count-anim { display: inline-block; transition: all 0.3s; }

  /* SUMMARY */
  .summary-box {
    background: linear-gradient(135deg, #0c1828, #122034);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 20px;
  }
  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  th { text-align: left; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold-dim); border-bottom: 1px solid rgba(201,168,76,0.15); font-weight: 400; }
  td { padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); }
  tr:last-child td { border-bottom: none; }
  td.num { color: var(--text); font-weight: 600; text-align: left; direction: ltr; }
  td.home { color: var(--gold-dim); text-align: left; direction: ltr; font-size: 13px; }
  td.highlight { color: var(--gold-light); font-weight: 700; }
  .type-badge { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
  .badge-i { background: rgba(74,158,202,0.2); color: var(--infantry); border: 1px solid rgba(74,158,202,0.3); }
  .badge-c { background: rgba(196,127,42,0.2); color: var(--cavalry); border: 1px solid rgba(196,127,42,0.3); }
  .badge-a { background: rgba(91,168,91,0.2); color: var(--archer); border: 1px solid rgba(91,168,91,0.3); }

  /* TIPS */
  .tips-box { background: rgba(201,168,76,0.04); border: 1px solid rgba(201,168,76,0.18); border-radius: 12px; padding: 16px 18px; }
  .tip-item { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 9px; font-size: 14px; line-height: 1.6; }
  .tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
  .tip-text strong { color: var(--gold-light); }

  /* RATIO BAR (already defined above) */

  /* HERO PORTRAIT */
  .hero-portrait {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(201,168,76,0.2);
    background: rgba(0,0,0,0.3);
  }
  .hero-card.selected .hero-portrait { border-color: var(--gold); }
  .hero-card.lethality-hero.selected .hero-portrait { border-color: #ff8060; }
  .hero-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }

  /* HERO OWNED CHECK */
  .hero-portrait { position: relative; }
  .portrait-owned { border-color: var(--gold) !important; }
  .deselect-btn {
    position: absolute; top: -6px; right: -6px;
    width: 20px; height: 20px;
    background: var(--blood-bright); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900; color: #fff;
    cursor: pointer; z-index: 10;
    transition: transform 0.15s;
  }
  .deselect-btn:hover { transform: scale(1.2); }
  .hero-card { cursor: pointer; user-select: none; transition: all 0.15s; }
  .hero-card:active { transform: scale(0.95); }
  .hero-card.selected {
    border: 2px solid var(--gold) !important;
    background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.08)) !important;
    transform: scale(1.02);
  }
  .hero-card.selected .hero-name { color: var(--gold-light); font-weight: 700; }
  .hero-card.selected .hero-portrait { border-color: var(--gold) !important; }

  /* REC CHIPS */
  .rec-hero-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
  .rec-hero-chip {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: rgba(0,0,0,0.3); border: 1px solid rgba(201,168,76,0.2);
    border-radius: 8px; padding: 6px 8px; min-width: 58px; position: relative;
  }
  .rec-chip-lead { border-color: #ff8060; background: rgba(192,57,43,0.1); }
  .rec-chip-img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; object-position: center top; }
  .rec-chip-name { font-size: 11px; color: var(--text); text-align: center; font-weight: 600; }
  .rec-chip-leth { font-size: 11px; position: absolute; top: 3px; right: 3px; }
  .rec-chip-pos { font-size: 9px; color: #ff8060; text-transform: uppercase; letter-spacing: 0.05em; }

  /* HERO MODE */
  .hero-mode-label { font-size: 15px; color: var(--text); margin-bottom: 12px; line-height: 1.5; }
  .hero-mode-label strong { color: var(--gold-light); }
  .hero-mode-note { font-size: 13px; color: var(--gold-dim); margin-top: 10px; font-style: italic; }
  .hero-mode-note strong { color: var(--parchment); }

  /* JOINER SLOTS */
  .joiner-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
  .joiner-slot { border-radius: 8px; padding: 10px 8px; text-align: center; }
  .joiner-slot-left { background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.35); }
  .joiner-slot-empty { background: rgba(0,0,0,0.25); border: 1px dashed rgba(255,255,255,0.1); }
  .slot-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold-dim); margin-bottom: 8px; }
  .joiner-slot-left .slot-label { color: var(--gold); }
  .slot-empty { font-size: 20px; color: rgba(255,255,255,0.15); padding: 10px 0; }
  .slot-heroes { display: flex; flex-direction: column; gap: 6px; align-items: center; }

  /* JOINER HERO CHIP (compact) */
  .joiner-hero-chip {
    display: flex; align-items: center; gap: 6px;
    background: rgba(0,0,0,0.3); border: 1px solid rgba(201,168,76,0.2);
    border-radius: 6px; padding: 4px 8px; width: 100%;
    cursor: default;
  }
  .joiner-hero-chip img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; object-position: center top; }
  .joiner-chip-name { font-size: 12px; font-weight: 600; color: var(--text); }
  .joiner-chip-or { font-size: 11px; color: var(--gold-dim); text-align: center; margin: 2px 0; }

  /* GEN SELECTOR */
  .gen-selector { margin-bottom: 16px; }
  .gen-label { font-size: 12px; color: var(--gold-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
  .gen-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
  .gen-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 20px;
    color: var(--parchment);
    font-family: inherit;
    font-size: 13px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .gen-btn:hover { border-color: rgba(201,168,76,0.4); transform: translateY(-1px); }
  .gen-btn.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.08));
    border-color: var(--gold);
    color: var(--gold-light);
    font-weight: 600;
  }


  /* MARCH RECOMMENDATION BOX */
  .march-rec-box {
    background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(201,168,76,0.04));
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: none;
    animation: fade-in 0.3s ease-out;
  }
  .march-rec-box.show { display: flex; align-items: center; gap: 12px; }
  .march-rec-icon { font-size: 28px; flex-shrink: 0; }
  .march-rec-text { flex: 1; }
  .march-rec-title { font-size: 14px; font-weight: 700; color: var(--gold-light); margin-bottom: 2px; }
  .march-rec-sub { font-size: 12px; color: var(--parchment); line-height: 1.5; }
  .march-rec-box.warning { border-color: rgba(192,57,43,0.5); background: linear-gradient(135deg, rgba(192,57,43,0.1), rgba(192,57,43,0.04)); }
  .march-rec-box.warning .march-rec-title { color: #ff8060; }

  .copy-march-btn {
    background: rgba(201,168,76,0.08);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 6px;
    color: var(--gold-dim);
    font-size: 13px;
    padding: 4px 9px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    letter-spacing: 0.03em;
    font-family: inherit;
  }
  .copy-march-btn:hover { background: rgba(201,168,76,0.2); color: var(--gold-light); border-color: var(--gold); transform: scale(1.05); }
  .copy-march-btn.copied { color: #5ba85b; border-color: #5ba85b; background: rgba(91,168,91,0.1); }
  .copy-march-btn:hover { background: rgba(201,168,76,0.25); color: var(--gold-light); }
  .copy-march-btn.copied { color: #5ba85b; border-color: #5ba85b; }

  /* LIGHT MODE */
  .bear-app.light-mode {
    --gold: #6b4818;        /* deeper bronze for stronger contrast */
    --gold-light: #3d2810;  /* dark espresso-bronze, very legible on warm cream */
    --gold-dim: #8a6520;
    --dark: #ebe0c8;        /* slightly warmer cream (was #f5f0e8) */
    --dark2: #e3d6b8;
    --dark3: #d6c69a;
    --parchment: #4a3416;
    --text: #2a1a08;
    --blood-bright: #a02818;
    background: linear-gradient(160deg, #ebe0c8 0%, #e3d6b8 100%);
    color: #2a1a08;
  }
  .bear-app.light-mode::before { opacity: 0.15; }
  .bear-app.light-mode .army-editor,
  .bear-app.light-mode .setting-box,
  .bear-app.light-mode .march-card,
  .bear-app.light-mode .summary-box,
  .bear-app.light-mode .hero-rec-box,
  .bear-app.light-mode .tips-box,
  .bear-app.light-mode .donut-wrap,
  .bear-app.light-mode .march-rec-box {
    background: linear-gradient(135deg, #ede5d5, #e0d5c0) !important;
  }
  .bear-app.light-mode input[type="number"] {
    background: rgba(255,255,255,0.7);
    color: #2a1a08;
    border-color: rgba(138,96,16,0.3);
  }
  .bear-app.light-mode .troop-block { background: rgba(255,255,255,0.5); }
  .bear-app.light-mode .toggle-btn,
  .bear-app.light-mode .lang-btn { background: rgba(255,255,255,0.5); color: #2a1a08; }
  .bear-app.light-mode .toggle-btn.active,
  .bear-app.light-mode .lang-btn.active { background: rgba(138,96,16,0.15); }
  .bear-app.light-mode .march-card { background: linear-gradient(160deg, #ede5d5, #e8dcc8) !important; }
  .bear-app.light-mode .rally-leader-card { background: linear-gradient(160deg, #f5e8e0, #eeddd4) !important; }

  .share-floating-btn,
  .theme-btn,
  .font-size-btn {
    display: none !important;
  }

  /* === Backup reminder banner === */
  .backup-reminder-banner {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(15,25,42,0.97), rgba(20,32,52,0.97));
    border: 1px solid rgba(201,168,76,0.55);
    border-radius: 10px;
    padding: 11px 14px;
    color: var(--text);
    font-size: 13px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 92vw;
    animation: slideUpFade 0.35s ease-out;
  }
  @keyframes slideUpFade {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
  .backup-reminder-icon { font-size: 18px; flex-shrink: 0; }
  .backup-reminder-text { flex: 1; min-width: 0; }
  .backup-reminder-action {
    background: linear-gradient(135deg, rgba(201,168,76,0.4), rgba(201,168,76,0.2));
    border: 1px solid rgba(201,168,76,0.7);
    color: var(--gold-light);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .backup-reminder-action:active { transform: scale(0.97); }
  .backup-reminder-close {
    background: transparent;
    border: none;
    color: rgba(220,210,180,0.6);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
  }
  .backup-reminder-close:hover { color: var(--gold-light); }

  /* === Auto-backup recovery modal === */
  .auto-backup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
  }
  .auto-backup-modal {
    background: linear-gradient(135deg, rgba(20,32,52,0.98), rgba(15,25,42,0.98));
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 12px;
    padding: 18px;
    color: var(--text);
    max-width: 420px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
  }
  .auto-backup-modal-title {
    font-family: inherit;
    font-weight: 700;
    color: var(--gold-light);
    font-size: 15px;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
  }
  .auto-backup-modal-sub {
    color: rgba(220,210,180,0.65);
    font-size: 12px;
    margin-bottom: 14px;
  }
  .auto-backup-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .auto-backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 6px;
    padding: 10px 12px;
  }
  .auto-backup-title { color: var(--gold-light); font-weight: 600; font-size: 13px; }
  .auto-backup-time { color: rgba(220,210,180,0.6); font-size: 11px; margin-top: 2px; }
  .auto-backup-restore-btn {
    background: linear-gradient(135deg, rgba(201,168,76,0.3), rgba(201,168,76,0.15));
    border: 1px solid rgba(201,168,76,0.5);
    color: var(--gold-light);
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .auto-backup-restore-btn:active { transform: scale(0.97); }
  .auto-backup-close-btn {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(201,168,76,0.25);
    color: var(--text);
    padding: 9px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
  }
  .bear-app.light-mode .backup-reminder-banner,
  .bear-app.light-mode .auto-backup-modal {
    background: linear-gradient(135deg, #f5ecd5, #ebe0c0);
    color: #3a2a14;
    border-color: rgba(122,96,48,0.4);
  }
  .bear-app.light-mode .backup-reminder-text,
  .bear-app.light-mode .auto-backup-modal-sub { color: #5a4830; }
  .bear-app.light-mode .auto-backup-time { color: rgba(90,72,48,0.7); }
  .bear-app.light-mode .auto-backup-item { background: rgba(255,255,255,0.5); border-color: rgba(122,96,48,0.25); }

  .calc-btn.loading {
    pointer-events: none;
    opacity: 0.8;
  }
  .calc-btn.loading span { display: none; }
  .calc-btn .btn-content { display: flex; align-items: center; justify-content: center; gap: 10px; }
  .calc-spinner {
    display: none;
    width: 20px; height: 20px;
    border: 2px solid rgba(201,168,76,0.3);
    border-top-color: var(--gold-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
  }
  .calc-btn.loading .calc-spinner { display: inline-block; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* SPARKLES */
  .sparkle {
    position: absolute;
    pointer-events: none;
    animation: sparkle-anim ease-in-out infinite;
  }
  @keyframes sparkle-anim {
    0%,100% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1) rotate(180deg); opacity: 1; }
  }


  footer { text-align: center; margin-top: 36px; font-size: 12px; color: var(--gold-dim); opacity: 0.35; letter-spacing: 0.12em; text-transform: uppercase; }
  .clan-signature {
    margin-top: 48px;
    padding: 28px 20px 20px;
    text-align: center;
    border-top: 1px solid rgba(201,168,76,0.15);
    position: relative;
  }
  .clan-signature::before {
    content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 120px; height: 1px;
    background: linear-gradient(90deg, transparent 0%, #c9a84c 50%, transparent 100%);
  }
  .sig-xxx {
    font-family: inherit;
    font-size: 22px; font-weight: 900; letter-spacing: 0.4em;
    background: linear-gradient(90deg, #fff5c0 0%, #f0d080 30%, #ffffff 50%, #f0d080 70%, #fff5c0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
    margin-bottom: 14px;
    display: inline-block;
  }
  .sig-motto {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 6px 14px; font-family: inherit;
    font-size: 13px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
    color: #e8d68a; opacity: 0.92;
    margin-bottom: 10px;
  }
  .sig-motto-word { white-space: nowrap; }
  .sig-motto-sep { color: #c9a84c; opacity: 0.6; font-size: 11px; }
  .sig-tagline { font-size: 10px; color: var(--gold-dim); opacity: 0.4; letter-spacing: 0.25em; text-transform: uppercase; margin-top: 8px; }
  .sig-credit {
    font-size: 11px; color: var(--gold-dim); opacity: 0.55;
    letter-spacing: 0.15em; text-transform: uppercase; margin-top: 6px;
    font-family: inherit;
  }
  .sig-credit span {
    background: linear-gradient(90deg, #f0d080 0%, #c9a84c 50%, #f0d080 100%);
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-weight: 700; letter-spacing: 0.18em;
    animation: shimmer 4s linear infinite;
  }
  .sig-visitors {
    font-size: 10px; color: var(--gold-dim); opacity: 0.5;
    letter-spacing: 0.18em; text-transform: uppercase; margin-top: 16px;
    font-family: inherit;
  }
  .sig-visitors #visitor-count {
    color: #f0d080; font-weight: 700; opacity: 0.95;
  }
  .visitor-badge {
    height: 32px;
    vertical-align: middle;
    opacity: 1;
    transition: transform 0.2s, filter 0.2s;
  }
  .visitor-badge:hover {
    transform: scale(1.06);
  }
  .bear-app.light-mode .visitor-badge {
  }

  /* === COMMENTS SECTION === */
  .comments-section {
    margin: 32px auto 16px;
    padding: 20px 18px;
    background: linear-gradient(180deg, rgba(15,30,60,0.6) 0%, rgba(8,18,40,0.4) 100%);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 10px;
    max-width: 100%;
  }
  .comments-title {
    text-align: center;
    font-family: inherit;
    font-size: 14px; font-weight: 700;
    letter-spacing: 0.25em; text-transform: uppercase;
    color: #d4b15c;
    margin-bottom: 16px;
  }

  /* Usage Guide */
  .usage-guide { display: flex; flex-direction: column; gap: 12px; }
  .usage-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    background: rgba(201,168,76,0.04);
    border: 1px solid rgba(201,168,76,0.12);
    border-radius: 8px;
  }
  .usage-step-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
  .usage-step-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--gold-light);
    margin-bottom: 3px;
  }
  .usage-step-text {
    font-size: 12px;
    color: rgba(220,210,180,0.75);
    line-height: 1.5;
  }
  .usage-step-text code {
    background: rgba(201,168,76,0.12);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--gold-light);
  }
  .bear-app.light-mode .usage-step { background: rgba(138,96,16,0.04); border-color: rgba(138,96,16,0.15); }
  .bear-app.light-mode .usage-step-title { color: #6b4d18; }
  .bear-app.light-mode .usage-step-text { color: #5a4830; }
  .bear-app.light-mode .usage-step-text code { background: rgba(138,96,16,0.1); color: #6b4d18; }

  /* Wave sent badge */
  .wave-sent-badge {
    font-size: 11px;
    color: #60d860;
    margin-left: auto;
    padding: 2px 6px;
    background: rgba(76,175,80,0.1);
    border: 1px solid rgba(76,175,80,0.3);
    border-radius: 10px;
  }
  .wave-sent { opacity: 0.55; }

  /* Plan History */
  .history-entry {
    padding: 9px 12px;
    border-radius: 7px;
    background: rgba(201,168,76,0.05);
    border: 1px solid rgba(201,168,76,0.12);
    margin-bottom: 7px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .history-entry:hover { background: rgba(201,168,76,0.12); }
  .history-entry-title { font-size: 13px; color: var(--parchment); font-weight: 600; }
  .history-entry-time { font-size: 11px; color: rgba(220,210,180,0.55); margin-top: 2px; }
  .bear-app.light-mode .history-entry { background: rgba(138,96,16,0.04); border-color: rgba(138,96,16,0.15); }
  .bear-app.light-mode .history-entry-title { color: #4a3010; }
  .bear-app.light-mode .history-entry-time { color: #8a7050; }
  /* Ticker (rotating approved comments) */
  .comments-ticker {
    position: relative;
    height: 80px;
    margin-bottom: 18px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
  }
  .ticker-item {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 10px 16px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
  }
  .ticker-item.active { opacity: 1; pointer-events: auto; }
  .ticker-msg {
    font-family: inherit;
    font-size: 14px;
    font-style: italic;
    color: #e8d68a;
    line-height: 1.4;
    margin-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .ticker-author {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.18em;
    color: #c9a84c;
    opacity: 0.85;
    text-transform: uppercase;
  }
  .ticker-empty {
    color: var(--gold-dim); opacity: 0.5;
    font-style: italic; font-size: 13px;
    font-family: inherit;
  }
  /* Comment form */
  .comment-form {
    display: flex; flex-direction: column; gap: 10px;
  }
  .comment-form input,
  .comment-form textarea {
    width: 100%; box-sizing: border-box;
    background: rgba(0,20,55,0.7);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 6px;
    color: #f0f8ff;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.2s;
  }
  .comment-form input:focus,
  .comment-form textarea:focus {
    border-color: rgba(201,168,76,0.7);
  }
  .comment-form textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    font-family: inherit;
  }
  .comment-form button {
    padding: 9px 16px;
    background: linear-gradient(180deg, rgba(201,168,76,0.25) 0%, rgba(138,96,16,0.2) 100%);
    border: 1px solid rgba(201,168,76,0.5);
    color: #f0d080;
    font-family: inherit;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .comment-form button:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(201,168,76,0.4) 0%, rgba(138,96,16,0.3) 100%);
  }
  .comment-form button:disabled { opacity: 0.5; cursor: wait; }
  .comment-status {
    font-size: 11px;
    text-align: center;
    margin-top: 4px;
    font-family: inherit;
    min-height: 14px;
  }
  .comment-status.success { color: #5ba85b; }
  .comment-status.error   { color: #c0392b; }
  .comment-status.info    { color: var(--gold-dim); }
  .comment-counter-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 10px; color: var(--gold-dim); opacity: 0.55;
    margin-top: -6px;
  }
  @media (max-width: 480px) {
    .comments-section { margin: 24px auto 12px; padding: 16px 12px; }
    .comments-title { font-size: 12px; letter-spacing: 0.2em; }
    .comments-ticker { height: 88px; }
    .ticker-msg { font-size: 13px; }
    .ticker-author { font-size: 9px; }
  }

  /* HERO SECTION */
  .hero-section {
    background: linear-gradient(135deg, #0c1828, #122034);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
  }
  .hero-section::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

  .hero-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 4px;
  }

  .hero-card {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
  }
  .hero-card:hover { border-color: rgba(201,168,76,0.3); background: rgba(0,0,0,0.5); }
  .hero-card.selected { border-color: var(--gold); background: rgba(201,168,76,0.08); }
  .hero-card.lethality-hero.selected { border-color: #e07060; background: rgba(192,57,43,0.1); }
  .hero-card.never-send { opacity: 0.4; }

  .hero-icon { font-size: 24px; flex-shrink: 0; }
  .hero-info { flex: 1; min-width: 0; }
  .hero-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-tags { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
  .hero-tag {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
  }
  .tag-archer  { background: rgba(91,168,91,0.2);  color: var(--archer); border: 1px solid rgba(91,168,91,0.3); }
  .tag-cavalry { background: rgba(196,127,42,0.2); color: var(--cavalry); border: 1px solid rgba(196,127,42,0.3); }
  .tag-infantry{ background: rgba(74,158,202,0.2); color: var(--infantry); border: 1px solid rgba(74,158,202,0.3); }
  .tag-lethality{ background: rgba(192,57,43,0.2); color: #ff8060; border: 1px solid rgba(192,57,43,0.3); }
  .tag-general { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(255,215,0,0.25); }
  .tag-tier-s  { background: rgba(255,200,50,0.15); color: #ffd700; border: 1px solid rgba(255,200,50,0.3); }
  .tag-tier-a  { background: rgba(180,120,220,0.15); color: #cc88ff; border: 1px solid rgba(180,120,220,0.3); }
  .tag-tier-b  { background: rgba(100,160,220,0.15); color: #88bbff; border: 1px solid rgba(100,160,220,0.3); }

  .hero-stars {
    display: flex;
    gap: 2px;
    margin-top: 5px;
    flex-wrap: nowrap;
  }
  .star-btn {
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s;
    line-height: 1;
    opacity: 0.3;
    background: none;
    border: none;
    padding: 0;
  }
  .star-btn.lit { opacity: 1; }
  .star-btn:hover { transform: scale(1.3); }

  .hero-recommend {
    position: absolute;
    top: 6px; right: 6px;
    font-size: 10px;
    background: rgba(201,168,76,0.2);
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.05em;
  }
  .hero-recommend.lead { background: rgba(192,57,43,0.2); border-color: rgba(192,57,43,0.4); color: #ff8060; }

  /* HERO RECOMMENDATION BOX */
  .hero-rec-box {
    background: rgba(201,168,76,0.06);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.7;
    display: none;
  }
  .hero-rec-box.show { display: block; animation: fade-in 0.3s ease-out; }
  @keyframes fade-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
  .hero-rec-title { font-weight: 700; color: var(--gold-light); margin-bottom: 6px; font-size: 14px; }
  .hero-rec-march { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; padding: 8px 10px; background: rgba(0,0,0,0.2); border-radius: 6px; }
  .hero-rec-label { font-weight: 600; color: var(--gold); min-width: 70px; flex-shrink: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
  .hero-rec-heroes { color: var(--text); font-size: 13px; }

  @media (max-width: 480px) {
    .settings-row { grid-template-columns: 1fr; }
    .troop-editor-row { grid-template-columns: 56px 1fr 1fr 1fr; gap: 4px; }
    .troop-editor-row .input-label { font-size: 10px; }
    .troop-editor-row input { font-size: 14px; padding: 6px 4px; }
    .donut-wrap { flex-direction: column; text-align: center; }
    .clan-signature { margin-top: 36px; padding: 24px 12px 18px; }
    .sig-xxx { font-size: 18px; letter-spacing: 0.35em; margin-bottom: 12px; }
    .sig-motto {
      flex-direction: column; gap: 4px;
      font-size: 11px; letter-spacing: 0.14em;
    }
    .sig-motto-sep { display: none; }
    .sig-motto-word::before { content: '⚔'; opacity: 0.5; margin-right: 6px; font-size: 9px; color: #c9a84c; }
    .sig-tagline { font-size: 9px; letter-spacing: 0.2em; }
    .sig-credit { font-size: 10px; letter-spacing: 0.12em; }
  }

  /* ============================================
     ALLIANCE PLANNER STYLES
     ============================================ */
  /* Preset Switcher */
  .preset-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }
  .preset-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(201,168,76,0.2);
    background: rgba(0,0,0,0.3);
    color: rgba(220,210,180,0.65);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.04em;
  }
  .preset-btn:hover { border-color: rgba(201,168,76,0.45); color: var(--parchment); }
  .preset-btn.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.08));
    border-color: var(--gold);
    color: var(--gold-light);
  }
  .bear-app.light-mode .preset-btn { background: rgba(138,96,16,0.06); color: #8a7050; border-color: rgba(138,96,16,0.2); }
  .bear-app.light-mode .preset-btn.active { background: rgba(138,96,16,0.18); border-color: rgba(138,96,16,0.6); color: #5a3a10; }

  .planner-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 4px 0 18px;
    padding: 6px;
    background: linear-gradient(135deg, rgba(12,24,40,0.7), rgba(18,32,52,0.5));
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 14px;
  }
  .planner-tab {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 10px;
    color: var(--parchment);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .planner-tab:hover {
    border-color: rgba(201,168,76,0.45);
    transform: translateY(-1px);
  }
  .planner-tab.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.08));
    border-color: var(--gold);
    color: var(--gold-light);
  }
  .bear-app.light-mode .planner-tabs {
    background: rgba(255,255,255,0.5);
    border-color: rgba(138,96,16,0.25);
  }
  .bear-app.light-mode .planner-tab {
    background: rgba(255,255,255,0.5);
    color: #2a1a08;
  }
  .bear-app.light-mode .planner-tab.active {
    background: rgba(138,96,16,0.15);
  }

  /* Alliance description */
  .alliance-desc {
    font-size: 12px;
    color: var(--gold-dim);
    line-height: 1.5;
    margin-bottom: 14px;
    font-style: italic;
  }
  .bear-app.light-mode .alliance-desc { color: #4a3618; opacity: 0.95; }

  /* Member list */
  #alliance-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }
  .alliance-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--gold-dim);
    font-style: italic;
    font-size: 13px;
    border: 1px dashed rgba(201,168,76,0.25);
    border-radius: 10px;
  }

  .member-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .member-card.is-toprl {
    border-color: rgba(255,200,80,0.5);
    background: linear-gradient(135deg, rgba(255,200,80,0.08), rgba(0,0,0,0.3));
  }
  .bear-app.light-mode .member-card {
    background: linear-gradient(135deg, #fdf8ec, #f3e8d0);
    border: 1px solid rgba(122,80,20,0.45);
  }
  .bear-app.light-mode .member-card.is-toprl {
    background: linear-gradient(135deg, rgba(255,200,80,0.35), #fdf8ec);
    border-color: rgba(180,130,30,0.7);
  }

  .member-card input[type="text"],
  .member-card input[type="number"] {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 8px 10px;
    transition: border-color 0.2s;
  }
  .member-card input[type="text"]:focus,
  .member-card input[type="number"]:focus {
    outline: none;
    border-color: var(--gold);
  }
  .bear-app.light-mode .member-card input[type="text"],
  .bear-app.light-mode .member-card input[type="number"] {
    background: #fff;
    color: #2a1a08;
    border: 1px solid rgba(122,80,20,0.45);
  }
  .bear-app.light-mode .member-card input[type="text"]:focus,
  .bear-app.light-mode .member-card input[type="number"]:focus {
    border-color: #8a6010;
  }
  .member-name { width: 100%; }
  .member-row-bottom {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
  }
  .member-power { flex: 1; min-width: 80px; }

  /* On narrow phones, give power input its own row so buttons fit cleanly below */
  @media (max-width: 420px) {
    .member-row-bottom { gap: 6px; }
    .member-power { flex: 1 1 100%; min-width: 0; }
    .member-toprl-label { flex: 1; justify-content: center; }
    .member-nearbear-label { flex: 1; justify-content: center; }
  }
  .member-toprl-label,
  .member-nearbear-label {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--parchment);
    user-select: none;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .member-nearbear-label {
    /* Distinct brown/bear accent so it's visually separable from the gold (RL) marker */
    border-color: rgba(150,90,40,0.35);
  }
  .member-toprl-label:hover { border-color: rgba(201,168,76,0.5); }
  .member-nearbear-label:hover { border-color: rgba(180,110,50,0.65); }
  .member-toprl-label input[type="checkbox"],
  .member-nearbear-label input[type="checkbox"] {
    margin: 0;
    accent-color: var(--gold);
    width: 12px;
    height: 12px;
    cursor: pointer;
  }
  .member-nearbear-label input[type="checkbox"] {
    accent-color: #b46e32;
  }
  .bear-app.light-mode .member-toprl-label {
    background: #fff8e8;
    color: #4a3618;
    border-color: rgba(122,80,20,0.45);
  }
  .bear-app.light-mode .member-toprl-label:hover { border-color: #8a6010; }
  .bear-app.light-mode .member-nearbear-label {
    background: #fff8e8;
    color: #4a3618;
    border-color: rgba(150,80,30,0.45);
  }
  .bear-app.light-mode .member-nearbear-label:hover { border-color: #8a4d10; }
  .member-delete {
    background: rgba(192,57,43,0.15);
    border: 1px solid rgba(192,57,43,0.4);
    color: #ff8060;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
  }
  .member-delete:hover {
    background: rgba(192,57,43,0.3);
    transform: scale(1.05);
  }
  .bear-app.light-mode .member-delete {
    background: rgba(192,57,43,0.18);
    color: #b03020;
    border-color: rgba(192,57,43,0.5);
  }
  .bear-app.light-mode .member-delete:hover {
    background: rgba(192,57,43,0.32);
  }

  /* Member status group */
  .member-status-group {
    display: flex;
    gap: 1px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 4px;
    padding: 1px;
    flex-shrink: 0;
  }
  .status-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
  }
  .status-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .status-option .status-icon {
    font-size: 12px;
    transition: all 0.15s;
    line-height: 1;
  }
  .status-option:hover {
    background: rgba(201,168,76,0.15);
  }
  .status-option.active {
    background: rgba(201,168,76,0.25);
  }
  .status-option.active .status-icon {
    transform: scale(1.1);
  }
  .bear-app.light-mode .member-status-group {
    background: #fff8e8;
    border: 1px solid rgba(122,80,20,0.45);
  }
  .bear-app.light-mode .status-option:hover {
    background: rgba(138,96,16,0.18);
  }
  .bear-app.light-mode .status-option.active {
    background: rgba(138,96,16,0.32);
  }
  
  /* Member card status visual indicators */
  .member-card.status-available {
    border-left: 4px solid #27ae60;
  }
  .member-card.status-leader {
    border-left: 4px solid var(--gold);
  }
  .member-card.status-unavailable {
    border-left: 4px solid #e74c3c;
    opacity: 0.6;
  }

  /* Add member button */
  .alliance-add-btn {
    width: 100%;
    background: rgba(201,168,76,0.1);
    border: 1px dashed rgba(201,168,76,0.4);
    color: var(--gold-light);
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
  }
  .alliance-add-btn:hover {
    background: rgba(201,168,76,0.18);
    border-style: solid;
    transform: translateY(-1px);
  }
  .bear-app.light-mode .alliance-add-btn {
    background: rgba(138,96,16,0.08);
    color: #6b4d18;
    border-color: rgba(138,96,16,0.4);
  }

  /* Alliance reset button */
  .alliance-reset-btn {
    background: rgba(50,100,200,0.15);
    border: 1px solid rgba(100,180,255,0.4);
    color: rgba(150,200,255,0.9);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.05em;
  }

  /* Alliance stats bar */
  /* Search + Filter Bar */
  .alliance-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0 6px;
    flex-wrap: wrap;
  }
  .alliance-search-input {
    flex: 1;
    min-width: 120px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--parchment);
    font-size: 13px;
    font-family: inherit;
    outline: none;
  }
  .alliance-search-input:focus { border-color: var(--gold-light); }
  .alliance-search-input::placeholder { color: rgba(220,210,180,0.35); font-style: italic; }
  .bear-app.light-mode .alliance-search-input { background: #fff8e8; color: #2a1a08; border-color: rgba(138,96,16,0.3); }
  .alliance-status-filters { display: flex; gap: 4px; }
  .filter-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(201,168,76,0.2);
    background: rgba(201,168,76,0.06);
    color: var(--parchment);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .filter-btn.active, .filter-btn:hover {
    background: rgba(201,168,76,0.18);
    border-color: rgba(201,168,76,0.5);
    color: var(--gold-light);
  }
  .bear-app.light-mode .filter-btn { background: rgba(138,96,16,0.06); color: #6b4d18; }
  .bear-app.light-mode .filter-btn.active { background: rgba(138,96,16,0.18); border-color: rgba(138,96,16,0.5); }

  .alliance-stats {
    padding: 12px;
    background: linear-gradient(135deg, rgba(201,168,76,0.08), rgba(201,168,76,0.03));
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 10px;
    margin-bottom: 8px;
  }
  .alliance-stats:empty { display: none; }

  .stats-grid {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
  }
  .stats-donut-block {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 200px;
    min-width: 200px;
  }
  .stats-donut {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
  }
  .donut-center-num {
    font-family: inherit;
    font-size: 7px;
    font-weight: 700;
    fill: var(--gold-light);
  }
  .donut-center-label {
    font-size: 3px;
    fill: rgba(220,210,180,0.6);
    letter-spacing: 0.1em;
  }
  .stats-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
  }
  .legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--parchment);
  }
  .legend-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .legend-count { color: var(--gold-light); font-weight: 700; }

  .stats-numbers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex: 1 1 200px;
    min-width: 180px;
  }
  .stat-num-item {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
  }
  .stat-num-value {
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1.1;
  }
  .stat-num-label {
    font-size: 10px;
    color: rgba(220,210,180,0.65);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 3px;
  }

  .tier-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(201,168,76,0.15);
  }
  .tier-section-title {
    font-size: 11px;
    color: var(--gold-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 700;
  }
  .tier-section-sub {
    color: rgba(220,210,180,0.55);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 10px;
    margin-left: 4px;
  }
  .bear-app.light-mode .tier-section-sub { color: rgba(90,72,48,0.65); }
  .tier-cols {
    display: flex;
    gap: 4px;
    align-items: stretch;
  }
  .tier-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    align-items: stretch;
  }
  .tier-col-bar {
    height: 14px;
    border-radius: 4px 4px 0 0;
  }
  .tier-col-info {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(201,168,76,0.12);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 5px 4px 6px;
    text-align: center;
    line-height: 1.2;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
  }
  .tier-col-label {
    font-size: 10px;
    color: rgba(220,210,180,0.85);
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  .tier-col-range {
    font-size: 9px;
    color: rgba(220,210,180,0.55);
    margin-top: 1px;
  }
  .tier-col-count {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-light);
    margin-top: 2px;
    line-height: 1;
  }
  .bear-app.light-mode .tier-col-info { background: rgba(255,255,255,0.5); border-color: rgba(122,96,48,0.2); }
  .bear-app.light-mode .tier-col-label { color: #2a1a08; }
  .bear-app.light-mode .tier-col-range { color: rgba(90,72,48,0.7); }
  .bear-app.light-mode .tier-col-count { color: #6b4d18; }

  .bear-app.light-mode .alliance-stats {
    background: linear-gradient(135deg, rgba(122,96,48,0.08), rgba(122,96,48,0.02));
    border-color: rgba(122,96,48,0.3);
  }
  .bear-app.light-mode .legend-row { color: #2a1a08; }
  .bear-app.light-mode .donut-center-num,
  .bear-app.light-mode .stat-num-value,
  .bear-app.light-mode .legend-count,
  .bear-app.light-mode .tier-section-title { color: #6b4d18; }
  .bear-app.light-mode .stat-num-item { background: rgba(255,255,255,0.5); border-color: rgba(122,96,48,0.2); }
  .bear-app.light-mode .stat-num-label,
  .bear-app.light-mode .donut-center-label { color: rgba(90,72,48,0.7); }
  .bear-app.light-mode .tier-bar { background: rgba(0,0,0,0.1); border-color: rgba(122,96,48,0.2); }

  /* Alliance action row (Add / Bulk Paste / Export / Import) */
  .alliance-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .alliance-actions .alliance-add-btn {
    flex: 2 1 180px;
    margin-bottom: 0;
  }
  .alliance-tool-btn {
    flex: 1 1 90px;
    background: rgba(201,168,76,0.07);
    border: 1px solid rgba(201,168,76,0.3);
    color: var(--gold-light);
    border-radius: 8px;
    padding: 10px 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .alliance-tool-btn:hover {
    background: rgba(201,168,76,0.16);
    transform: translateY(-1px);
  }
  .alliance-tool-btn.alliance-warn {
    background: rgba(180,60,60,0.12);
    border-color: rgba(220,90,90,0.45);
    color: rgba(255,180,180,0.95);
  }
  .alliance-tool-btn.alliance-warn:hover { background: rgba(180,60,60,0.22); }
  .alliance-tool-btn.alliance-cancel {
    background: rgba(120,120,120,0.1);
    border-color: rgba(180,180,180,0.3);
    color: rgba(220,220,220,0.85);
  }
  .bear-app.light-mode .alliance-tool-btn { background: rgba(138,96,16,0.06); color: #6b4d18; border-color: rgba(138,96,16,0.35); }
  .bear-app.light-mode .alliance-tool-btn.alliance-warn { background: rgba(160,40,40,0.08); color: #8a2020; border-color: rgba(160,40,40,0.4); }
  .bear-app.light-mode .alliance-tool-btn.alliance-cancel { background: rgba(80,80,80,0.06); color: #444; border-color: rgba(80,80,80,0.25); }

  /* Modal (used for Bulk Paste & Import) */
  .alliance-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 20px 12px;
    overflow-y: auto;
    animation: fade-in 0.18s ease-out;
  }
  .alliance-modal-content {
    background: linear-gradient(135deg, var(--dark2), var(--dark3));
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 12px;
    padding: 18px;
    max-width: 520px;
    width: 100%;
    margin: auto;
  }
  .bear-app.light-mode .alliance-modal-content {
    background: linear-gradient(135deg, #faf3e3, #f4ead0);
    border-color: rgba(138,96,16,0.5);
  }
  .alliance-modal-title {
    font-family: inherit;
    font-size: 16px;
    color: var(--gold-light);
    margin-bottom: 8px;
    letter-spacing: 0.06em;
  }
  .bear-app.light-mode .alliance-modal-title { color: #6b4d18; }
  .alliance-modal-hint {
    font-size: 12px;
    color: rgba(220,210,180,0.7);
    margin-bottom: 10px;
    line-height: 1.45;
  }
  .bear-app.light-mode .alliance-modal-hint { color: #5a4830; }
  .ocr-first-time-info {
    background: linear-gradient(135deg, rgba(201,168,76,0.08), rgba(201,168,76,0.03));
    border: 1px solid rgba(201,168,76,0.35);
    border-radius: 8px;
    padding: 14px;
    margin: 4px 0 14px 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text);
  }
  .ocr-first-time-info .ocr-fti-title {
    font-family: inherit;
    font-weight: 700;
    color: var(--gold-light);
    font-size: 14px;
    margin-bottom: 10px;
    letter-spacing: 0.03em;
    text-align: center;
  }
  .ocr-first-time-info .ocr-fti-intro {
    margin-bottom: 12px;
    color: rgba(232,223,192,0.9);
  }
  .ocr-first-time-info .ocr-fti-cta {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, rgba(201,168,76,0.35), rgba(201,168,76,0.18));
    border: 1px solid rgba(201,168,76,0.7);
    color: var(--gold-light);
    padding: 11px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    margin: 10px 0 14px 0;
    transition: all 0.2s;
    letter-spacing: 0.02em;
  }
  .ocr-first-time-info .ocr-fti-cta:hover,
  .ocr-first-time-info .ocr-fti-cta:active {
    background: linear-gradient(135deg, rgba(201,168,76,0.5), rgba(201,168,76,0.25));
    transform: translateY(-1px);
  }
  .ocr-first-time-info .ocr-fti-steps-title {
    font-weight: 700;
    color: var(--gold-light);
    margin-bottom: 6px;
    font-size: 12px;
  }
  .ocr-first-time-info ol {
    list-style: none;
    counter-reset: fti;
    padding: 0;
    margin: 0 0 10px 0;
  }
  .ocr-first-time-info ol li {
    counter-increment: fti;
    padding: 4px 0 4px 26px;
    position: relative;
  }
  .ocr-first-time-info ol li::before {
    content: counter(fti);
    position: absolute;
    left: 0; top: 4px;
    width: 18px; height: 18px;
    background: rgba(201,168,76,0.2);
    border: 1px solid rgba(201,168,76,0.5);
    border-radius: 50%;
    color: var(--gold-light);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    line-height: 16px;
  }
  .ocr-first-time-info code {
    background: rgba(0,0,0,0.4);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--gold-light);
    font-size: 11px;
  }
  .ocr-first-time-info .ocr-fti-footnote {
    font-size: 11px;
    color: rgba(220,210,180,0.6);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(201,168,76,0.15);
    line-height: 1.5;
  }
  .bear-app.light-mode .ocr-first-time-info {
    background: linear-gradient(135deg, rgba(122,96,48,0.08), rgba(122,96,48,0.02));
    border-color: rgba(122,96,48,0.4);
    color: #5a4830;
  }
  .bear-app.light-mode .ocr-first-time-info .ocr-fti-title { color: #6b4d18; }
  .bear-app.light-mode .ocr-first-time-info .ocr-fti-intro { color: #5a4830; }
  .bear-app.light-mode .ocr-first-time-info .ocr-fti-cta {
    background: linear-gradient(135deg, rgba(122,96,48,0.25), rgba(122,96,48,0.12));
    border-color: rgba(122,96,48,0.6);
    color: #6b4d18;
  }
  .bear-app.light-mode .ocr-first-time-info .ocr-fti-steps-title { color: #6b4d18; }
  .bear-app.light-mode .ocr-first-time-info code {
    background: rgba(255,255,255,0.5);
    color: #6b4d18;
  }
  .bear-app.light-mode .ocr-first-time-info .ocr-fti-footnote { color: rgba(90,72,48,0.7); }
  .alliance-modal-textarea {
    width: 100%;
    min-height: 140px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 8px;
    padding: 10px;
    color: var(--parchment);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
  }
  .alliance-modal-textarea:focus {
    outline: none;
    border-color: var(--gold-light);
  }
  .alliance-modal-textarea::placeholder {
    color: rgba(220,210,180,0.28);
    font-style: italic;
    font-size: 12px;
  }
  .bear-app.light-mode .alliance-modal-textarea::placeholder {
    color: rgba(90,72,48,0.35);
  }
  .bear-app.light-mode .alliance-modal-textarea {
    background: #fff8e8;
    color: #2a1a08;
    border-color: rgba(138,96,16,0.4);
  }
  .alliance-modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
  }
  .alliance-modal-actions > button { flex: 1 1 100px; }

  /* Bulk paste preview area */
  .alliance-bulk-preview {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
  }
  .alliance-bulk-preview:empty { display: none; }
  .preview-header {
    font-size: 12px;
    color: var(--gold-light);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(201,168,76,0.3);
    letter-spacing: 0.04em;
  }
  .bear-app.light-mode .preview-header { color: #6b4d18; border-bottom-color: rgba(138,96,16,0.3); }
  .preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(201,168,76,0.05);
    margin-bottom: 4px;
    font-size: 13px;
  }
  .bear-app.light-mode .preview-row { background: rgba(138,96,16,0.06); }
  .preview-num {
    color: rgba(220,210,180,0.55);
    font-size: 11px;
    min-width: 22px;
  }
  .bear-app.light-mode .preview-num { color: #8a7050; }
  .preview-name {
    flex: 1;
    color: var(--parchment);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bear-app.light-mode .preview-name { color: #2a1a08; }
  .preview-power {
    color: var(--gold-light);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    min-width: 50px;
    text-align: right;
  }
  .bear-app.light-mode .preview-power { color: #6b4d18; }
  .preview-rl {
    background: linear-gradient(135deg, rgba(255,200,80,0.25), rgba(255,200,80,0.1));
    border: 1px solid rgba(255,200,80,0.4);
    color: rgba(255,220,140,0.95);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }
  .bear-app.light-mode .preview-rl { color: #6b4d18; background: linear-gradient(135deg, rgba(255,200,80,0.35), rgba(255,200,80,0.15)); }
  .preview-remove {
    background: transparent;
    border: 1px solid rgba(220,90,90,0.4);
    color: rgba(255,150,150,0.85);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 0;
  }
  .preview-remove:hover { background: rgba(220,90,90,0.18); }
  .bear-app.light-mode .preview-remove { color: #8a2020; border-color: rgba(160,40,40,0.4); }

  /* OCR Screenshot Upload */
  .ocr-upload-section {
    margin: 12px 0;
  }
  .ocr-upload-area {
    border: 2px dashed rgba(201,168,76,0.4);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(201,168,76,0.03);
  }
  .ocr-upload-area:hover {
    border-color: rgba(201,168,76,0.6);
    background: rgba(201,168,76,0.06);
  }
  .bear-app.light-mode .ocr-upload-area {
    background: rgba(138,96,16,0.04);
    border-color: rgba(138,96,16,0.4);
  }
  .bear-app.light-mode .ocr-upload-area:hover {
    border-color: rgba(138,96,16,0.6);
    background: rgba(138,96,16,0.08);
  }
  .ocr-upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
  }
  .ocr-upload-text {
    color: var(--parchment);
  }
  .ocr-upload-sub {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
  }
  .bear-app.light-mode .ocr-upload-text { color: #6b4d18; }

  /* OCR Progress */
  #ocr-progress {
    margin: 15px 0;
    text-align: center;
  }
  .ocr-progress-text {
    color: var(--gold-light);
    margin-bottom: 8px;
    font-size: 13px;
  }
  .bear-app.light-mode .ocr-progress-text { color: #6b4d18; }
  .ocr-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
  }
  .bear-app.light-mode .ocr-progress-bar { background: rgba(138,96,16,0.15); }
  .ocr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
  }

  /* OCR Preview */
  .ocr-preview-title {
    font-size: 13px;
    color: var(--gold-light);
    margin-bottom: 8px;
    font-weight: 600;
  }
  .bear-app.light-mode .ocr-preview-title { color: #6b4d18; }
  .ocr-preview-hint {
    font-size: 11px;
    color: rgba(220,210,180,0.7);
    margin-bottom: 10px;
  }
  .bear-app.light-mode .ocr-preview-hint { color: #5a4830; }
  #ocr-preview-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
  }

  /* OCR Fallback Image Preview */
  .ocr-fallback-container {
    text-align: center;
  }
  .ocr-fallback-title {
    font-size: 13px;
    color: var(--gold-light);
    margin-bottom: 8px;
    font-weight: 600;
  }
  .bear-app.light-mode .ocr-fallback-title { color: #6b4d18; }
  .ocr-fallback-hint {
    font-size: 11px;
    color: rgba(220,210,180,0.7);
    margin-bottom: 15px;
    line-height: 1.4;
  }
  .bear-app.light-mode .ocr-fallback-hint { color: #5a4830; }
  .ocr-image-container {
    margin: 15px 0;
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
  }
  .bear-app.light-mode .ocr-image-container {
    border-color: rgba(138,96,16,0.3);
    background: rgba(255,255,255,0.1);
  }
  .ocr-preview-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
  }
  .ocr-fallback-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
  }

  /* Online toggle */
  .ocr-online-toggle {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(76,175,80,0.08);
    border: 1px solid rgba(76,175,80,0.3);
    border-radius: 8px;
  }
  .ocr-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
  }
  .ocr-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #60d860;
    cursor: pointer;
  }
  .ocr-toggle-text {
    font-size: 13px;
    color: #90e890;
  }
  .bear-app.light-mode .ocr-online-toggle { background: rgba(76,175,80,0.06); border-color: rgba(60,140,60,0.3); }
  .bear-app.light-mode .ocr-toggle-text { color: #2a7a2a; }

  /* Processing spinner */
  .ocr-spinner {
    font-size: 28px;
    animation: ocr-spin 1.4s linear infinite;
    margin-bottom: 12px;
  }
  @keyframes ocr-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  .ocr-processing-text {
    color: var(--gold-light);
    font-size: 13px;
  }
  .bear-app.light-mode .ocr-processing-text { color: #6b4d18; }

  /* Results list */
  #ocr-results-list {
    max-height: 240px;
    overflow-y: auto;
  }
  .ocr-result-header {
    font-size: 12px;
    color: var(--gold-light);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(201,168,76,0.3);
  }
  .bear-app.light-mode .ocr-result-header { color: #6b4d18; }

  /* Wave cards */
  .alliance-wave-card {
    background: linear-gradient(135deg, var(--dark2), var(--dark3));
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    animation: fade-in 0.3s ease-out;
  }
  .alliance-wave-card.wave-top-rl {
    border-color: rgba(255,200,80,0.55);
    background: linear-gradient(135deg, rgba(28,22,8,0.95), rgba(20,18,12,0.95));
  }
  .bear-app.light-mode .alliance-wave-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(245,235,210,0.7));
    border-color: rgba(138,96,16,0.3);
  }
  .bear-app.light-mode .alliance-wave-card.wave-top-rl {
    background: linear-gradient(135deg, rgba(255,235,180,0.85), rgba(255,250,225,0.7));
    border-color: rgba(180,130,30,0.6);
  }
  .wave-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(201,168,76,0.2);
  }
  .wave-number {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .wave-time {
    font-family: inherit;
    font-size: 13px;
    color: var(--parchment);
    background: rgba(201,168,76,0.1);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(201,168,76,0.25);
  }
  .bear-app.light-mode .wave-time { color: #2a1a08; background: rgba(138,96,16,0.08); }

  .wave-rally-schedule {
    font-family: inherit;
    font-size: 12px;
    color: rgba(224,160,112,0.85);
    background: rgba(180,110,50,0.1);
    border: 1px solid rgba(180,110,50,0.25);
    border-radius: 8px;
    padding: 5px 10px;
    margin: 6px 0 8px;
    letter-spacing: 0.02em;
  }
  .bear-app.light-mode .wave-rally-schedule {
    color: #6b3d18;
    background: rgba(180,110,50,0.08);
  }

  .wave-leader-row, .wave-joiner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
  }
  .wave-leader-row {
    background: linear-gradient(90deg, rgba(201,168,76,0.18), rgba(201,168,76,0.06));
    border: 1px solid rgba(201,168,76,0.3);
    margin-bottom: 6px;
  }
  .bear-app.light-mode .wave-leader-row {
    background: linear-gradient(90deg, rgba(138,96,16,0.15), rgba(138,96,16,0.04));
    border-color: rgba(138,96,16,0.3);
  }
  .bear-app.light-mode .wave-joiner-row { background: rgba(255,255,255,0.4); }
  .wave-role-label {
    font-size: 12px;
    color: var(--gold-dim);
    flex-shrink: 0;
    min-width: 28px;
  }
  .wave-leader-row .wave-role-label { color: var(--gold-light); font-weight: 600; }
  .wave-name {
    font-size: 14px;
    color: var(--text);
    flex: 1;
    word-break: break-word;
  }
  .bear-app.light-mode .wave-name { color: #2a1a08; }
  .wave-leader-row .wave-name { font-weight: 700; color: var(--gold-light); }
  .bear-app.light-mode .wave-leader-row .wave-name { color: #6b4d18; }

  /* === Manual swap interactivity === */
  .wave-leader-row {
    cursor: pointer;
    user-select: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
  }
  .wave-leader-row:active { transform: scale(0.985); }
  /* When swap mode is active, non-selected rows show subtle hint */
  .alliance-wave-card.swap-mode-active .wave-leader-row.swap-target {
    border-style: dashed;
    border-color: rgba(201,168,76,0.45);
    opacity: 0.92;
  }
  .alliance-wave-card.swap-mode-active .wave-leader-row.swap-target::after {
    content: '↔';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 14px;
    opacity: 0.55;
    animation: swapHintPulse 1.3s ease-in-out infinite;
  }
  @keyframes swapHintPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.85; }
  }
  /* Selected player — strong gold glow */
  .wave-leader-row.swap-selected {
    background: linear-gradient(90deg, rgba(255,215,0,0.42), rgba(255,180,0,0.22));
    border-color: var(--gold-light);
    border-width: 2px;
    animation: selectedPulse 1.6s ease-in-out infinite;
  }
  @keyframes selectedPulse {
    0%, 100% { }
    50%      { }
  }
  .bear-app.light-mode .wave-leader-row.swap-selected {
    background: linear-gradient(90deg, rgba(255,200,80,0.55), rgba(255,180,40,0.3));
    border-color: #6b4818;
  }
  .bear-app.light-mode .alliance-wave-card.swap-mode-active .wave-leader-row.swap-target::after {
    color: #6b4818;
  }

  /* Swap-mode hint banner */
  .alliance-swap-hint {
    background: linear-gradient(90deg, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
    border: 1px dashed rgba(201,168,76,0.35);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--parchment);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
  }
  .alliance-swap-reset {
    background: rgba(192,57,43,0.18);
    border: 1px solid rgba(192,57,43,0.5);
    color: #ff8b7a;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
  }
  .alliance-swap-reset:hover { background: rgba(192,57,43,0.3); }
  .bear-app.light-mode .alliance-swap-hint {
    background: linear-gradient(90deg, rgba(138,96,16,0.08), rgba(138,96,16,0.02));
    border-color: rgba(138,96,16,0.4);
    color: #4a3618;
  }
  .bear-app.light-mode .alliance-swap-reset {
    background: rgba(160,40,24,0.15);
    border-color: rgba(160,40,24,0.5);
    color: #a02818;
  }
  .wave-toprl-badge {
    font-size: 14px;
    color: #ffd700;
  }
  .wave-empty-slot {
    font-size: 11px;
    color: var(--gold-dim);
    font-style: italic;
    text-align: center;
    padding: 4px;
    border: 1px dashed rgba(201,168,76,0.2);
    border-radius: 6px;
    margin-top: 4px;
  }
  /* Capacity hint shown under the leader row */
  .wave-cap-hint {
    font-size: 11px;
    color: rgba(220,210,180,0.65);
    text-align: center;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(201,168,76,0.06);
    border-radius: 6px;
    letter-spacing: 0.04em;
  }
  .wave-cap-hint strong {
    color: var(--gold-light);
    font-size: 13px;
  }
  .alliance-wave-card.wave-top-rl .wave-cap-hint {
    background: rgba(255,200,80,0.1);
  }
  .alliance-wave-card.wave-top-rl .wave-cap-hint strong {
    color: rgba(255,220,140,0.95);
  }
  .bear-app.light-mode .wave-cap-hint { color: #5a4830; background: rgba(138,96,16,0.06); }
  .bear-app.light-mode .wave-cap-hint strong { color: #6b4d18; }

  /* Copy button */
  /* Wave interval selector (Alliance) */
  .alliance-interval-section {
    margin: 14px 0 8px;
    padding: 11px 12px;
    background: rgba(201,168,76,0.06);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 8px;
  }
  .alliance-interval-label {
    font-size: 11px;
    color: var(--gold-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
  }
  .alliance-interval-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .alliance-interval-btn {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 6px;
    color: var(--parchment);
    padding: 9px 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    min-width: 0;
  }
  .alliance-interval-btn:hover {
    border-color: rgba(201,168,76,0.5);
  }
  .alliance-interval-btn.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.35), rgba(201,168,76,0.18));
    border-color: var(--gold-light);
    color: var(--gold-light);
  }
  .bear-app.light-mode .alliance-interval-section {
    background: rgba(122,80,20,0.05);
    border-color: rgba(122,80,20,0.25);
  }
  .bear-app.light-mode .alliance-interval-btn {
    background: #fff8e8;
    color: #4a3618;
    border-color: rgba(122,80,20,0.35);
  }
  .bear-app.light-mode .alliance-interval-btn.active {
    background: linear-gradient(135deg, rgba(122,80,20,0.3), rgba(122,80,20,0.15));
    border-color: #6b4818;
    color: #2a1a08;
  }
  /* Auto/manual hint line under buttons */
  .alliance-interval-hint {
    margin-top: 9px;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    color: rgba(220,210,180,0.65);
    min-height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .alliance-interval-hint .hint-auto {
    color: rgba(91,168,91,0.85);
    letter-spacing: 0.04em;
  }
  .alliance-interval-hint .hint-manual {
    color: rgba(240,208,128,0.85);
    letter-spacing: 0.04em;
  }
  .alliance-interval-hint .hint-auto-btn {
    background: rgba(91,168,91,0.12);
    border: 1px solid rgba(91,168,91,0.45);
    color: #6ec06e;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 10.5px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: all 0.18s;
  }
  .alliance-interval-hint .hint-auto-btn:hover,
  .alliance-interval-hint .hint-auto-btn:active {
    background: rgba(91,168,91,0.22);
    border-color: rgba(91,168,91,0.7);
  }
  .bear-app.light-mode .alliance-interval-hint { color: rgba(74,54,24,0.75); }
  .bear-app.light-mode .alliance-interval-hint .hint-auto { color: #2d6e2d; }
  .bear-app.light-mode .alliance-interval-hint .hint-manual { color: #6b4818; }

  /* Sticky Generate Bar */
  .alliance-sticky-bar {
    position: sticky;
    bottom: 0;
    z-index: 50;
    padding: 10px 0 14px;
    background: linear-gradient(to top, var(--dark) 60%, transparent);
    pointer-events: none;
    margin-top: 8px;
  }
  .alliance-sticky-generate {
    pointer-events: all;
    width: 100%;
  }
  .bear-app.light-mode .alliance-sticky-bar {
    background: linear-gradient(to top, #f5ead8 60%, transparent);
  }

  .alliance-copy-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(46,125,50,0.25), rgba(46,125,50,0.12));
    border: 1px solid rgba(76,175,80,0.5);
    color: #a5d6a7;
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    letter-spacing: 0.06em;
  }
  .alliance-copy-btn:hover {
    background: linear-gradient(135deg, rgba(46,125,50,0.4), rgba(46,125,50,0.18));
    transform: translateY(-1px);
  }
  .bear-app.light-mode .alliance-copy-btn {
    background: rgba(76,175,80,0.15);
    color: #2e7d32;
    border-color: rgba(76,175,80,0.5);
  }

  /* Toast notification */
  .copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    animation: toast-in 0.3s ease-out, toast-out 0.3s ease-out 1.7s forwards;
    letter-spacing: 0.04em;
  }
  @keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
  @keyframes toast-out {
    to { opacity: 0; transform: translate(-50%, 20px); }
  }

  /* === Recruitment section (subtle, non-intrusive) === */
  .recruit-section {
    max-width: 540px;
    margin: 32px auto 8px;
    padding: 0 12px;
  }
  .recruit-card {
    background: linear-gradient(160deg, rgba(201,168,76,0.08) 0%, rgba(15,25,42,0.4) 100%);
    border: 1px solid rgba(201,168,76,0.32);
    border-radius: 14px;
    padding: 24px 22px;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  .recruit-card::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -40%;
    width: 180%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(255,215,100,0.07), transparent 60%);
    pointer-events: none;
  }
  .recruit-emblem {
    font-family: inherit;
    font-weight: 900;
    font-size: 38px;
    background: linear-gradient(135deg, #ffd966 0%, #c9a84c 50%, #8a6010 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.12em;
    line-height: 1;
    margin-bottom: 10px;
  }
  .recruit-emblem .x-small { font-size: 0.62em; vertical-align: 0.15em; }
  .recruit-title {
    font-family: inherit;
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
  }
  .recruit-subtitle {
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--gold-dim);
    text-transform: uppercase;
    margin-bottom: 18px;
  }
  .recruit-subtitle strong { color: var(--gold-light); font-weight: 700; }
  .recruit-why {
    list-style: none;
    margin: 0 0 18px 0;
    padding: 0;
    text-align: left;
  }
  .recruit-why li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    border-bottom: 1px solid rgba(201,168,76,0.08);
  }
  .recruit-why li:last-child { border-bottom: none; }
  .recruit-check {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(91,168,91,0.22), rgba(91,168,91,0.08));
    border: 1px solid rgba(91,168,91,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6ec06e;
    font-size: 11px;
    font-weight: 700;
    margin-top: 1px;
  }
  .recruit-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 13px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: all 0.2s ease;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.1);
  }
  .recruit-cta:hover, .recruit-cta:active {
    transform: translateY(-1px);
  }
  .recruit-cta-icon { font-size: 16px; flex-shrink: 0; }
  .recruit-cta-text { flex: 1; text-align: left; }
  .recruit-cta-arrow { opacity: 0.85; }
  .recruit-ingame {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 8px;
    font-size: 13px;
    flex-wrap: wrap;
  }
  .recruit-ingame-icon { font-size: 16px; }
  .recruit-ingame-label {
    color: var(--gold-dim);
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }
  .recruit-ingame-name {
    color: var(--gold-light);
    font-weight: 700;
    font-size: 14px;
  }
  .bear-app.light-mode .recruit-card {
    background: linear-gradient(160deg, rgba(122,80,20,0.1) 0%, rgba(245,234,216,0.7) 100%);
    border-color: rgba(122,80,20,0.4);
  }
  .bear-app.light-mode .recruit-title { color: #2a1a08; }
  .bear-app.light-mode .recruit-why li { color: #2a1a08; border-color: rgba(122,80,20,0.1); }
  .bear-app.light-mode .recruit-ingame { background: rgba(255,255,255,0.5); border-color: rgba(122,80,20,0.25); }
  .bear-app.light-mode .recruit-ingame-name { color: #6b4818; }
  @media (max-width: 380px) {
    .recruit-emblem { font-size: 32px; }
    .recruit-title { font-size: 16px; }
    .recruit-card { padding: 20px 16px; }
  }

/* --- Readable flat UI (site-aligned, dark-only) --- */
.bear-app {
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bear-app .section-title,
.bear-app .page-title,
.bear-app .march-role,
.bear-app .calc-btn,
.bear-app .alliance-modal-title {
  font-family: inherit !important;
}

.bear-app .section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bear-app,
.bear-app * {
  text-shadow: none !important;
  box-shadow: none !important;
}

.bear-app * {
  filter: none !important;
}

.bear-app img,
.bear-app video {
  filter: none !important;
}

.bear-app .march-card:hover,
.bear-app .toggle-btn:hover,
.bear-app .lang-btn:hover {
  transform: none;
}

.bear-app input[type="number"],
.bear-app input[type="text"],
.bear-app textarea,
.bear-app select {
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.bear-app input[type="number"]:focus,
.bear-app input[type="text"]:focus,
.bear-app textarea:focus {
  outline: 2px solid rgba(201, 162, 39, 0.35);
  outline-offset: 1px;
}

.bear-app .tip-text,
.bear-app .setting-label,
.bear-app .march-rec-text,
.bear-app label {
  color: var(--text);
  line-height: 1.5;
}

.bear-app .tip-text strong,
.bear-app .setting-sublabel {
  color: var(--text);
}

.bear-app .army-editor,
.bear-app .setting-box,
.bear-app .march-card,
.bear-app .summary-box,
.bear-app .tips-box,
.bear-app .hero-rec-box,
.bear-app .march-rec-box,
.bear-app .alliance-member-card,
.bear-app .alliance-modal-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
}

.bear-app .calc-btn,
.bear-app .alliance-sticky-generate {
  background: var(--accent) !important;
  color: var(--bg-dark) !important;
  font-weight: 600;
  border: none !important;
}

.bear-app .calc-btn:hover,
.bear-app .alliance-sticky-generate:hover {
  background: var(--accent-hover) !important;
}

/* Force dark palette even if old localStorage had light theme */
.bear-app.light-mode {
  --gold: var(--accent);
  --gold-light: var(--accent-hover);
  --gold-dim: var(--accent-dim);
  --dark: var(--bg-dark);
  --dark2: var(--bg-card);
  --dark3: #252a38;
  --parchment: var(--text-muted);
  --text: var(--text);
  background: transparent !important;
  color: var(--text) !important;
}
