/* ==========================================================================
   AZ ELRABOLT HERCEGNŐ NYOMÁBAN - FANTASY KALANDKÖNYV STÍLUSLAP
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=MedievalSharp&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --parchment-base: #f7eed8;
  --parchment-deep: #ebdcbe;
  --parchment-shadow: #c8b088;
  --ink-primary: #231812;
  --ink-secondary: #4a3424;
  --ink-muted: #6b533e;
  --gold-primary: #c59b27;
  --gold-light: #f3d46f;
  --gold-dark: #8c6a12;
  --crimson-blood: #881919;
  --crimson-dark: #5e0c0c;
  --crimson-light: #b32525;
  --magic-blue: #1b4965;
  --leather-brown: #2e1a0f;
  --leather-edge: #1a0d07;
  --border-ornament: #805b38;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-book: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 8px 24px rgba(46, 26, 15, 0.2);
}

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

body {
  font-family: 'Lora', 'Georgia', serif;
  background-color: #120b06;
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(55, 33, 19, 0.8) 0%, rgba(18, 11, 6, 0.98) 85%),
    radial-gradient(circle at 10% 10%, rgba(197, 155, 39, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--ink-primary);
  line-height: 1.7;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbar dizájn */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--leather-edge);
}
::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* FEJLÉC ÉS VEZÉRLŐPULT */
.game-header {
  background: linear-gradient(180deg, var(--leather-edge) 0%, var(--leather-brown) 100%);
  border-bottom: 3px solid var(--gold-dark);
  color: var(--gold-light);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-crest {
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.header-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--gold-light);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.header-subtitle {
  font-family: 'MedievalSharp', cursive;
  font-size: 13px;
  color: #cbb493;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-header {
  background: linear-gradient(135deg, #442a17 0%, #29160b 100%);
  color: #eeddbb;
  border: 1px solid var(--gold-dark);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header:hover {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
  color: #1a0d07;
  border-color: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 155, 39, 0.4);
}

/* FŐ ELRENDEZÉS */
.main-layout {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 25px auto;
  width: 95%;
  gap: 30px;
  align-items: flex-start;
}

/* KALANDLAP / KARAKTERLAP (SIDEBAR) */
.character-sheet {
  width: 320px;
  background: var(--parchment-base);
  background-image: 
    radial-gradient(circle at 50% 50%, var(--parchment-base) 0%, var(--parchment-deep) 100%),
    repeating-linear-gradient(45deg, rgba(160, 120, 80, 0.03) 0px, rgba(160, 120, 80, 0.03) 2px, transparent 2px, transparent 6px);
  border: 8px solid var(--leather-brown);
  border-image: linear-gradient(to bottom, #4a2d18, #2a160a, #4a2d18) 8;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-book);
  position: sticky;
  top: 85px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  flex-shrink: 0;
}

.sheet-title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  text-align: center;
  color: var(--leather-edge);
  border-bottom: 2px dashed var(--border-ornament);
  padding-bottom: 10px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stat-box {
  background: rgba(235, 220, 190, 0.85);
  border: 1px solid var(--border-ornament);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.stat-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  font-family: 'MedievalSharp', cursive;
  font-size: 20px;
  font-weight: bold;
  color: var(--leather-edge);
}

.stat-bar-outer {
  width: 100%;
  height: 14px;
  background: #d4c2a3;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #aa9473;
}

.stat-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #b32525 0%, #2e7d32 100%);
  width: 100%;
  transition: width 0.4s ease, background 0.4s ease;
}

.btn-stat-action {
  margin-top: 8px;
  width: 100%;
  padding: 5px;
  font-size: 11px;
  font-family: 'Cinzel', serif;
  background: #deb887;
  border: 1px solid #8b6b43;
  border-radius: 4px;
  cursor: pointer;
  color: #2b180d;
  font-weight: 600;
  transition: 0.2s;
}

.btn-stat-action:hover {
  background: #c59b27;
  color: #fff;
}

/* KÉSZLET / TÁRGYAK */
.inventory-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.inventory-item {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid #c8b088;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-primary);
}

.inventory-item.item-usable {
  cursor: pointer;
  background: rgba(220, 240, 220, 0.7);
  border-color: #5b925b;
}

.inventory-item.item-usable:hover {
  background: #4caf50;
  color: white;
}

.item-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #a37f48;
  color: white;
  font-family: 'Cinzel', serif;
}

/* KÖNYV TARTALOM (BOOK DISPLAY) */
.book-container {
  flex: 1;
  background: var(--parchment-base);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.4) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(200, 170, 130, 0.25) 0%, transparent 60%),
    linear-gradient(to right, rgba(0,0,0,0.06) 0%, transparent 4%, transparent 96%, rgba(0,0,0,0.06) 100%),
    radial-gradient(circle at 50% 50%, var(--parchment-base) 0%, var(--parchment-deep) 100%);
  border: 12px solid #3d2314;
  border-image: linear-gradient(to bottom right, #5c351e, #29150b, #5c351e) 12;
  border-radius: var(--radius-lg);
  padding: 35px 45px;
  box-shadow: var(--shadow-book);
  position: relative;
  min-height: 650px;
  display: flex;
  flex-direction: column;
}

/* Díszes sarokelemek */
.book-container::before,
.book-container::after {
  content: '❧';
  position: absolute;
  font-size: 30px;
  color: var(--gold-dark);
  opacity: 0.6;
}
.book-container::before {
  top: 10px;
  left: 15px;
}
.book-container::after {
  bottom: 10px;
  right: 15px;
  transform: rotate(180deg);
}

/* FEJEZET ILLUSZTRÁCIÓ */
.chapter-hero {
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 3px solid #8c6a12;
  box-shadow: 0 8px 20px rgba(46, 26, 15, 0.35);
  margin-bottom: 25px;
  background: #2b180d;
}

.chapter-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.chapter-hero:hover img {
  transform: scale(1.03);
}

.chapter-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(20, 10, 5, 0.95) 0%, rgba(20, 10, 5, 0.4) 60%, transparent 100%);
  padding: 20px 25px 12px;
  color: #f7eed8;
}

.chapter-badge {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  display: block;
  margin-bottom: 3px;
}

.chapter-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

/* FEJEZET SZÖVEG */
.chapter-body {
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink-primary);
  margin-bottom: 30px;
  flex: 1;
}

.chapter-body p {
  margin-bottom: 16px;
  text-indent: 1.2em;
}

.chapter-body p:first-of-type {
  text-indent: 0;
}

.chapter-body p:first-of-type::first-letter {
  font-family: 'MedievalSharp', cursive;
  font-size: 52px;
  float: left;
  line-height: 0.85;
  padding-right: 10px;
  padding-top: 4px;
  color: var(--crimson-blood);
  text-shadow: 1px 1px 1px var(--gold-dark);
}

.chapter-note {
  background: rgba(197, 155, 39, 0.15);
  border-left: 4px solid var(--gold-dark);
  padding: 12px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-secondary);
}

/* VÁLASZTÁSI LEHETŐSÉGEK (CHOICES) */
.choices-container {
  margin-top: auto;
  padding-top: 25px;
  border-top: 2px dashed var(--border-ornament);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.choice-btn {
  background: linear-gradient(135deg, #fff7ea 0%, #ecd7b7 100%);
  border: 2px solid #8c6a12;
  border-radius: var(--radius-md);
  padding: 14px 22px;
  color: var(--leather-edge);
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  box-shadow: 0 4px 10px rgba(60, 35, 20, 0.15);
}

.choice-btn:hover {
  background: linear-gradient(135deg, #fcedc5 0%, #dfb555 100%);
  border-color: #50360a;
  transform: translateX(8px);
  box-shadow: 0 6px 16px rgba(140, 106, 18, 0.35);
}

.choice-btn .choice-arrow {
  font-size: 20px;
  color: var(--crimson-blood);
  font-weight: bold;
}

.choice-btn .choice-target {
  font-size: 13px;
  background: var(--leather-brown);
  color: var(--gold-light);
  padding: 4px 10px;
  border-radius: 12px;
  font-family: 'Lora', serif;
}

/* HARCI ARÉNA (COMBAT ARENA PANEL) */
.combat-card {
  background: linear-gradient(135deg, #2b1309 0%, #170a04 100%);
  border: 3px solid var(--crimson-blood);
  border-radius: var(--radius-md);
  padding: 22px;
  color: #f7eed8;
  margin: 25px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.combat-header {
  text-align: center;
  border-bottom: 2px solid var(--crimson-dark);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.combat-title {
  font-family: 'Cinzel', serif;
  color: #ff9999;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.combat-select {
  background: #1f1008;
  color: #f7eed8;
  border: 1px solid var(--gold-dark);
  padding: 5px 10px;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.combat-select:hover {
  border-color: var(--gold-light);
}

.combatants-grid {
  display: grid;
  grid-template-columns: 1fr 70px 1fr;
  align-items: center;
  gap: 15px;
  text-align: center;
  margin-bottom: 20px;
}

.combatant-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
}

.mini-bar-outer {
  width: 100%;
  height: 8px;
  background: #3a2217;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mini-bar-inner {
  height: 100%;
  transition: width 0.35s ease, background 0.35s ease;
}

.mini-bar-inner.hero-bar {
  background: #4caf50;
}

.mini-bar-inner.enemy-bar {
  background: #e53935;
}

.combat-dice-row {
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.combat-dice-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'MedievalSharp', cursive;
  font-size: 18px;
  color: var(--gold-light);
  min-width: 80px;
  display: inline-block;
  transition: transform 0.2s;
}

.combat-power-badge {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}

.combat-vs-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.combat-round-badge {
  font-size: 11px;
  font-family: 'Cinzel', serif;
  background: var(--gold-dark);
  color: #1a0d07;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.combatant-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.combatant-hero .combatant-name {
  color: #81c784;
}

.combatant-enemy .combatant-name {
  color: #e57373;
}

.combat-vs {
  font-family: 'MedievalSharp', cursive;
  font-size: 24px;
  color: var(--gold-light);
}

.combat-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.btn-fight {
  background: linear-gradient(135deg, var(--crimson-light) 0%, var(--crimson-dark) 100%);
  color: #fff;
  border: 2px solid #ff7777;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(179, 37, 37, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-fight:hover {
  background: linear-gradient(135deg, #e53935 0%, #881919 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.6);
}

.combat-log {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #4a2818;
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 140px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  color: #ded1be;
  text-align: left;
}

.log-entry {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}
.log-hero-hit { color: #81c784; }
.log-enemy-hit { color: #e57373; }
.log-parry { color: #ffd54f; }

/* KOCKA DOBOZ ÉS 3D ANIMÁLT KOCKÁK */
.dice-panel {
  background: rgba(235, 220, 190, 0.85);
  border: 1px solid var(--border-ornament);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 15px;
  text-align: center;
}

.dice-tray {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 10px 0;
  min-height: 52px;
}

.die {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 2px solid #333;
  border-radius: 8px;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.3), inset 0 0 6px rgba(0,0,0,0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: bold;
  color: #1a0d07;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.die.rolling {
  animation: roll-anim 0.5s ease-in-out infinite alternate;
}

@keyframes roll-anim {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.95); }
}

.dice-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-dice {
  background: #c59b27;
  color: #1a0d07;
  border: 1px solid #8c6a12;
  border-radius: 4px;
  padding: 6px 12px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-dice:hover {
  background: #e2b73a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* MODAL ÉS SZERENCSE PRÓBA */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 5, 2, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--parchment-base);
  border: 8px solid var(--leather-brown);
  border-radius: var(--radius-md);
  padding: 30px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-book);
  text-align: center;
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  color: var(--leather-edge);
  margin-bottom: 15px;
}

/* TELJES KÖNYVOLVASÓ NÉZET (PRINT / ALL CHAPTERS) */
.reader-mode-container {
  display: none;
  max-width: 900px;
  margin: 30px auto;
  background: var(--parchment-base);
  border: 12px solid #3d2314;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-book);
}

.reader-mode-container.active {
  display: block;
}

.reader-chapter-item {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px dashed var(--border-ornament);
}

.reader-chapter-number {
  font-family: 'Cinzel', serif;
  font-size: 26px;
  color: var(--crimson-blood);
  font-weight: bold;
  margin-bottom: 12px;
}

/* LÁBLÉC */
.game-footer {
  text-align: center;
  padding: 20px;
  color: #92755e;
  font-size: 13px;
  font-family: 'Cinzel', serif;
  margin-top: auto;
}

/* RESZPONZÍV ELRENDEZÉS MOBILRA ÉS TABLETRE */
@media (max-width: 992px) {
  .main-layout {
    flex-direction: column;
  }
  .character-sheet {
    width: 100%;
    position: static;
    max-height: none;
  }
  .book-container {
    padding: 25px 20px;
  }
  .chapter-hero {
    height: 200px;
  }
  .chapter-title {
    font-size: 20px;
  }
  .combatants-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* NYOMTATÁSI STÍLUS */
@media print {
  body {
    background: white;
    color: black;
  }
  .game-header, .character-sheet, .choices-container, .combat-card, .btn-header, .dice-panel {
    display: none !important;
  }
  .book-container, .reader-mode-container {
    border: none;
    box-shadow: none;
    padding: 0;
    display: block !important;
  }
  .reader-chapter-item {
    page-break-inside: avoid;
  }
}
