:root {
  --paper: #f3efe4;
  --ink: #1d1a16;
  --muted: #70685d;
  --line: #241f1a;
  --soft-line: #c8bfae;
  --panel: #fffaf0;
  --warning: #fff0d8;
  --warning-line: #a66a00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #d9d1c3;
  font-family: Georgia, "Times New Roman", serif;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 3px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.app-header h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
}

.app-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.mobile-notice {
  display: none;
}

@media (max-width: 820px) {
  .mobile-notice {
    display: block;
    margin: 0.8rem 1rem 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 0.9rem;
    line-height: 1.35;
  }
}

.print-button {
  border: 2px solid var(--line);
  background: #ffffff;
  padding: 0.55rem 0.8rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(520px, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.editor-column,
.sheet-panel {
  min-width: 0;
}

.editor-column {
  display: flex;
  flex-direction: column;
}

.column-intro {
  margin: 0 0 0.45rem 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.column-intro h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.column-intro p {
  margin: 0;
  max-width: 52rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.25;
}

.editor-panel {
  background: var(--panel);
  border: 3px solid var(--line);
  padding: 1rem;
  min-height: 200vh;
  overflow: auto;
}

fieldset {
  border: 2px solid var(--line);
  margin: 0 0 1rem;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.35);
}

legend {
  padding: 0 0.35rem;
  font-weight: bold;
  font-size: 1.05rem;
}

label {
  display: block;
  margin: 0.7rem 0 0.25rem;
  font-weight: bold;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0.45rem;
  font: inherit;
}

textarea {
  resize: vertical;
}

.hint,
.field-note,
.counter,
.small-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.hint ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  margin-top: 0.4rem;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-weight: normal;
}

.checkbox-line input {
  width: auto;
}

.counter {
  margin-top: 0.4rem;
  font-weight: bold;
}

.sheet {
  position: sticky;
  top: 1rem;
  background: var(--paper);
  border: 5px double var(--line);
  padding: 1.2rem;
  min-height: calc(100vh - 8rem);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.22);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  border-bottom: 3px solid var(--line);
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
}

.sheet-header h2 {
  margin: 0;
  font-size: 2rem;
}

.sheet-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.sheet-logo {
  border: 3px solid var(--line);
  padding: 0.6rem;
  font-weight: bold;
  font-size: 1.2rem;
}

.sheet-section {
  border-bottom: 1px solid var(--soft-line);
  padding: 0.75rem 0;
}

.sheet-section h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}

.sheet-section h4 {
  margin: 0 0 0.4rem;
}

.info-grid,
.attribute-grid,
.derived-grid {
  display: grid;
  gap: 0.55rem;
}

.info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.attribute-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.info-box,
.attribute-box,
.derived-box {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  padding: 0.5rem;
  min-height: 3.2rem;
}

.attribute-box {
  min-height: 4.8rem;
}

.derived-box {
  min-height: 4.9rem;
}

.info-box span,
.attribute-box span,
.derived-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.info-box strong,
.attribute-box strong,
.derived-box strong {
  display: block;
  margin-top: 0.2rem;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-list span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  padding: 0.25rem 0.4rem;
}

.rules-list {
  margin: 0;
  padding-left: 1.2rem;
}

.warnings {
  border: 2px solid var(--warning-line);
  background: var(--warning);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.warnings h3 {
  margin-top: 0;
}

.warnings ul {
  margin-bottom: 0;
}

/*
  Würfelsymbole

  Farben, Konturen, Texturen und die Symbolschrift kommen zentral aus:
  /css/zdh-dice.css

  Diese Datei regelt für den Heldengenerator nur Größen, Ausrichtung
  und Abstände der Symbole.
*/

.die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 0;
  border: none;
  background: transparent;
  line-height: 1;
  overflow: visible;
  vertical-align: middle;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
}

.die .symbol {
  display: inline-block;
  font-size: 1.75rem;
  line-height: 1;
  text-align: center;
}

/* Boxen mit Würfeln: Titel oben, Würfelinhalt mittig */

.info-box:has(.die),
.attribute-box,
.derived-box {
  display: grid !important;
  grid-template-rows: auto 1fr !important;
  align-items: stretch !important;
}

.info-box:has(.die) > span,
.attribute-box > span,
.derived-box > span {
  align-self: start !important;
}

/* Stufe und Attribute: Symbol über Wert, gemeinsam zentriert */

.info-box:has(.die) > strong,
.attribute-box > strong {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  align-self: center !important;
  width: max-content !important;
  gap: 0.08rem !important;
  margin-top: 0 !important;
  line-height: 1 !important;
}

/* Abwehr, Gewandtheit, Zähigkeit, Zuversicht: Würfelreihe zentriert */

.derived-box > strong.dice-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  align-self: center !important;
  gap: 0.45rem !important;
  margin-top: 0 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.info-box:has(.die) .die,
.attribute-box .die,
.derived-box .die {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  line-height: 1 !important;
}

.info-box:has(.die) .die .symbol,
.attribute-box .die .symbol,
.derived-box .die .symbol {
  line-height: 1 !important;
}

/* kleinere Symbole in Regeltexten */

.hint .die .symbol,
.rules-list .die .symbol {
  font-size: 1.05em;
}

.hint .die,
.rules-list .die {
  vertical-align: 0.1em;
}

.competence-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.competence-note p {
  margin: 0.12rem 0;
}

.competence-note .die {
  vertical-align: 0.08em;
  margin: 0 0.06em;
}

.competence-note .die .symbol {
  font-size: 1em;
}

.hobby-rule {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.hobby-rule .die {
  vertical-align: 0.08em;
  margin: 0 0.06em;
}

.hobby-rule .die .symbol {
  font-size: 1em;
}

.conditional-field {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--soft-line);
}

.is-hidden {
  display: none !important;
}

.money-breakdown {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: normal;
}

/* Würfelfarben-Leiste unten links */

.dice-showcase {
  margin-top: 0.3rem;
  padding: 0;
  border-top: none;
  text-align: center;
}

.dice-showcase h3,
.dice-showcase-labels {
  display: none;
}

.dice-showcase-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 0.1rem 0.25rem;
  margin: 0 auto;
  line-height: 1;
}

.dice-showcase-row .die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.dice-showcase-row .die .symbol {
  font-size: 1.5rem;
  line-height: 1;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sheet {
    position: static;
  }

  .info-grid,
  .attribute-grid,
  .derived-grid,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    min-height: auto;
  }
}


/* Einheitlicher Generator-Kopfbereich */

.app-header {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr minmax(0, auto) 1fr !important;
  grid-template-areas:
    "left center right"
    "left meta right";
  align-items: center !important;
  justify-items: center !important;
  gap: 0.18rem 1rem !important;
  min-height: 6rem;
  padding: 0.55rem 1.25rem 0.45rem !important;
  border-bottom: 3px solid var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
  overflow: hidden;
}

.header-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  text-align: center;
  min-width: 0;
}

.header-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.06rem;
  text-align: center;
  min-width: 0;
}

.header-action {
  grid-area: right;
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.logo-image {
  display: block;
  width: auto;
  max-width: 135px;
  max-height: 60px;
  height: auto;
}

.generator-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.05;
}

.version-label,
.site-link {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.05;
}

.site-link {
  text-decoration: none;
  white-space: nowrap;
}

.site-link:hover,
.site-link:focus {
  text-decoration: underline;
}

.app-header .print-button {
  border: 2px solid var(--line) !important;
  background: #ffffff;
  padding: 0.42rem 0.72rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .app-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.28rem !important;
    min-height: auto;
    padding: 0.65rem 0.8rem 0.55rem !important;
    text-align: center;
  }

  .header-action {
    order: 1;
    justify-content: center;
  }

  .header-center {
    order: 2;
  }

  .header-meta {
    order: 3;
  }

  .logo-image {
    max-width: 135px;
    max-height: 60px;
  }

  .generator-name {
    font-size: 1.12rem;
  }

  .site-link,
  .version-label {
    font-size: 0.72rem;
  }
}

/* Version 0.3a/070: gemeinsamer Generator-Header und Footer */
.app-header {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  grid-template-areas: "left center right" !important;
  align-items: center !important;
  justify-items: center !important;
  min-height: 5.1rem !important;
  padding: 0.55rem 1.25rem 0.45rem !important;
  border-bottom: 3px solid var(--line) !important;
  background: var(--paper) !important;
  overflow: visible !important;
}

.header-center {
  grid-area: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.06rem !important;
  text-align: center !important;
  min-width: 0 !important;
}

.header-action {
  grid-area: right !important;
  justify-self: end !important;
  align-self: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
}

.header-meta {
  display: none !important;
}

.logo-link {
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-decoration: none !important;
}

.logo-image {
  display: block !important;
  width: auto !important;
  max-width: 135px !important;
  max-height: 60px !important;
  height: auto !important;
  object-fit: contain !important;
}

.generator-name {
  margin: 0 !important;
  color: var(--ink) !important;
  font-size: 1.42rem !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
}

.generator-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  padding: 0.55rem 1rem 0.8rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.1;
}

.generator-footer .site-link {
  color: var(--muted);
  text-decoration: none;
}

.generator-footer .site-link:hover,
.generator-footer .site-link:focus {
  text-decoration: underline;
}

.generator-footer .version-label {
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.28rem !important;
    min-height: auto !important;
    padding: 0.65rem 0.8rem 0.55rem !important;
    text-align: center !important;
  }

  .header-action {
    order: 1 !important;
    justify-content: center !important;
    width: 100% !important;
  }

  .header-center {
    order: 2 !important;
  }

  .generator-name {
    font-size: 1.42rem !important;
  }

  .generator-footer {
    font-size: 0.76rem;
    padding-bottom: 0.7rem;
  }
}
