/* drunkdragon.ru 1.21.0 — the site on a phone (the owner's list of 20.11.2026). Loaded after every other style of the
   site, so equal selectors here win. Desktop (1024 px and wider) keeps its look; the only change there is the compact
   list of music moods. */

/* ---------- parts that exist only in the stacked layout (phone, tablet) ---------- */
.dd-sheet-summary,
.dd-sheet-bar,
.dd-sheet-backdrop,
.dd-sheet-panel__close,
.dd-music-bar .dd-sheet-open-btn { display: none; }

/* ---------- 1.23.0: the site page itself never scrolls — its parts do (the home view, the reader's frame, the chat…).
   On a phone «100vh» (the body's least height) is taller than the visible screen by the browser's own bar, so a finger on
   the header scrolled the whole page: the site's top bar went up and an empty strip showed at the bottom. Only pages
   with the app (.dd-app); /legal and other plain pages scroll as before. ---------- */
html:has(body .dd-app),
html:has(body .dd-app) > body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- music moods: compact chips instead of eleven tall rows (all widths) ---------- */
.dd-music-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.dd-music-presets .dd-preset { flex: 0 1 auto; min-width: 0; min-height: 36px; padding: 0 14px; gap: 6px; border-radius: var(--dd-radius-full); background: var(--dd-surface-card); box-shadow: none; }
.dd-music-presets .dd-preset:hover { transform: none; }
.dd-music-presets .dd-preset.active,
.dd-music-presets .dd-preset.is-active,
.dd-music-presets .dd-preset[aria-pressed="true"] { border-color: var(--dd-gold); background: var(--dd-surface-elevated); box-shadow: none; }
.dd-music-presets .dd-preset--custom { grid-column: auto; background: var(--dd-surface-card); border-color: var(--dd-border-strong); }
.dd-music-presets .dd-preset__icon { display: none; }
.dd-music-presets .dd-preset--custom .dd-preset__icon { display: flex; width: auto; height: auto; background: none; border: 0; }
.dd-music-presets .dd-preset--custom .dd-preset__icon svg { width: 15px; height: 15px; }
.dd-music-presets .dd-preset__info { flex: 0 1 auto; }
.dd-music-presets .dd-preset__sub { display: none; }
.dd-music-presets .dd-preset__title { font-size: .8125rem; font-weight: 500; line-height: 1.2; color: var(--dd-ink-muted); }
.dd-music-presets .dd-preset[aria-pressed="true"] .dd-preset__title { color: var(--dd-gold-bright); font-weight: 600; }
@media (pointer: coarse) {
  .dd-music-presets .dd-preset { min-height: 40px; }
}

/* ==========================================================================
   Stacked layout: phone and tablet (narrower than 1024 px)
   ========================================================================== */
@media (max-width: 1023px) {
  .dd-workspace > .dd-workspace__main { align-self: stretch; }

  /* --- settings as a sheet from the bottom (Арты и карты, Статблоки, Музыка) --- */
  .dd-sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: var(--dd-overlay-backdrop);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dd-duration-normal) var(--dd-ease), visibility 0s linear var(--dd-duration-normal);
  }
  .is-sheet-open > .dd-sheet-backdrop { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dd-duration-normal) var(--dd-ease), visibility 0s; }

  .dd-workspace > .dd-inspector.dd-sheet-panel {
    position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 61;
    width: auto; max-width: 720px; margin: 0 auto;
    height: auto; min-height: 0; max-height: calc(100dvh - 48px);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 18px calc(18px + env(safe-area-inset-bottom));
    border: 1px solid var(--dd-border-strong); border-bottom: 0;
    border-radius: var(--dd-radius-xl) var(--dd-radius-xl) 0 0;
    background: var(--dd-surface-panel);
    box-shadow: 0 -16px 40px -12px rgba(0, 0, 0, .75);
    transform: translateY(102%); visibility: hidden;
    transition: transform .34s var(--dd-ease), visibility 0s linear .34s;
  }
  .is-sheet-open > .dd-inspector.dd-sheet-panel { transform: none; visibility: visible; transition: transform .34s var(--dd-ease), visibility 0s; }
  .is-sheet-open { overflow: hidden !important; }
  #dd-statblock-view:has(> .dd-workspace.is-sheet-open),
  #dd-music-view:has(> .dd-workspace.is-sheet-open) { overflow: hidden !important; }

  .dd-sheet-panel__head {
    position: sticky; top: 0; z-index: 3;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 -18px; padding: 20px 18px 12px;
    background: var(--dd-surface-panel);
    border-bottom: 1px solid var(--dd-border);
  }
  .dd-sheet-panel__head::before {
    content: ''; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--dd-border-strong);
  }
  .dd-sheet-panel .dd-sheet-panel__head h2 { margin: 0; padding: 0; border: 0; min-width: 0; font-size: var(--dd-text-h4); line-height: 1.25; }
  .dd-sheet-panel__close {
    display: inline-flex; align-items: center; flex: none; min-height: 40px; padding: 0 18px;
    border: 1px solid var(--dd-border-strong); border-radius: var(--dd-radius-full);
    background: var(--dd-surface-elevated); color: var(--dd-gold-bright);
    font: 600 var(--dd-text-sm)/1 var(--dd-font-body); cursor: pointer;
  }
  .dd-sheet-panel__close:focus-visible { outline: none; box-shadow: var(--dd-shadow-focus); }

  /* the action of a sheet stays in reach at its bottom */
  .dd-sheet-panel .dd-sheet-action {
    position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); z-index: 2;
    margin: 4px -18px calc(-18px - env(safe-area-inset-bottom));
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
    background: var(--dd-surface-panel); border-top: 1px solid var(--dd-border);
  }
  .dd-sheet-panel .dd-sheet-action .dd-btn { min-height: 48px; }

  /* nothing inside a sheet scrolls on its own: the sheet scrolls */
  .dd-sheet-panel .dd-styles { min-height: 0; max-height: none; overflow: visible; overscroll-behavior: auto; }
  .dd-sheet-panel .dd-sb-preview img { max-height: 34vh; max-height: 34dvh; width: 100%; object-fit: contain; }

  /* --- «Арты и карты»: what is chosen, above the description field; a tap opens the settings. The gallery ends above
     the field (it is fixed at the bottom and taller now), so its last row can be scrolled into view --- */
  .dd-workspace.dd-workspace--image { padding-bottom: calc(156px + env(safe-area-inset-bottom)); }
  .dd-composer .dd-sheet-summary {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0 0 8px; padding: 5px 12px 5px 6px;
    border: 1px solid var(--dd-border-strong); border-radius: var(--dd-radius-md);
    background: var(--dd-surface-card); color: var(--dd-ink-primary); font: inherit; text-align: left; cursor: pointer;
  }
  .dd-composer .dd-sheet-summary:focus-visible { outline: none; box-shadow: var(--dd-shadow-focus); }
  .dd-sheet-summary__icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: rgba(196, 164, 124, .12); color: var(--dd-gold); }
  .dd-sheet-summary__icon .dd-ico { width: 18px; height: 18px; }
  .dd-sheet-summary__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  .dd-sheet-summary__text strong,
  .dd-sheet-summary__text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dd-sheet-summary__text strong { font: 600 .8125rem/1.3 var(--dd-font-body); color: var(--dd-ink-primary); }
  .dd-sheet-summary__text span { font-size: .75rem; line-height: 1.3; color: var(--dd-ink-muted); }
  .dd-sheet-summary__go { flex: none; font: 600 .8125rem/1 var(--dd-font-body); color: var(--dd-gold-bright); }

  /* --- «Статблоки»: the parchment from a bar at the bottom of the screen --- */
  #dd-statblock-view .dd-sheet-bar {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 26;
    display: flex; align-items: center; gap: 12px; max-width: 720px; min-height: 60px; margin: 0 auto; padding: 8px 14px 8px 8px;
    border: 1px solid var(--dd-border-gold); border-radius: var(--dd-radius-lg);
    background: rgba(18, 9, 29, .97); box-shadow: 0 14px 32px -8px rgba(0, 0, 0, .8);
    color: var(--dd-ink-primary); font: inherit; text-align: left; cursor: pointer;
  }
  #dd-statblock-view .dd-sheet-bar:focus-visible { outline: none; box-shadow: var(--dd-shadow-focus), 0 14px 32px -8px rgba(0, 0, 0, .8); }
  .dd-sheet-bar__media { flex: none; display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 8px; background: rgba(196, 164, 124, .12); color: var(--dd-gold); }
  .dd-sheet-bar__media img { width: 100%; height: 100%; object-fit: cover; }
  .dd-sheet-bar__media .dd-ico { width: 22px; height: 22px; }
  .dd-sheet-bar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .dd-sheet-bar__text strong { font: 600 var(--dd-text-ui)/1.2 var(--dd-font-body); color: var(--dd-gold-bright); }
  .dd-sheet-bar__text span { font-size: .8125rem; line-height: 1.3; color: var(--dd-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dd-sheet-bar__go { flex: none; display: grid; place-items: center; color: var(--dd-gold); }
  .dd-sheet-bar.is-busy .dd-sheet-bar__media { animation: dd-sheet-busy 1.4s ease-in-out infinite; }
  @keyframes dd-sheet-busy { 50% { opacity: .45; } }
  #dd-statblock-view > .dd-workspace { padding-bottom: 100px; }

  /* --- «Музыка»: «Создать трек» at the top --- */
  .dd-music-bar { flex-wrap: wrap; }
  .dd-music-bar .dd-sheet-open-btn { display: inline-flex; justify-content: center; gap: 8px; flex: 1 1 100%; min-height: 46px; }
  .dd-music-bar .dd-sheet-open-btn .dd-ico { width: 18px; height: 18px; }
}

.dd-profile-view .dd-prof-btn-edit { margin-top: 8px; }
.dd-prof-edit-form { display: grid; gap: 8px; }
.dd-prof-edit-form label { color: var(--dd-ink-muted); font-size: var(--dd-text-ui); }
.dd-prof-edit-form .dd-input,
.dd-prof-edit-form .dd-select { width: 100%; min-height: 44px; font-size: max(16px, var(--dd-text-ui)); }
.dd-prof-edit-form .dd-select { margin-bottom: 4px; }
.dd-prof-edit-form .dd-btn { min-height: 44px; }
.dd-prof-edit-error { margin: 2px 0; color: var(--dd-ink-error); overflow-wrap: anywhere; }

@media (max-width: 1023px) and (prefers-reduced-motion: reduce) {
  .dd-workspace > .dd-inspector.dd-sheet-panel,
  .is-sheet-open > .dd-inspector.dd-sheet-panel,
  .dd-sheet-backdrop { transition: none; }
  .dd-sheet-bar.is-busy .dd-sheet-bar__media { animation: none; }
}

/* ==========================================================================
   Phone (600 px and narrower)
   ========================================================================== */
@media (max-width: 600px) {
  /* --- top bar: only «Пьяный дракон»; the name of the section was squeezed under it --- */
  .dd-topbar .dd-topbar__subtitle { display: none; }
  .dd-topbar__titles { min-width: 0; }
  .dd-topbar__brand-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* --- «Главная»: every tool in view, three to a row (the row that had to be scrolled sideways did not move on phones) --- */
  .dd-home-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin: 6px 0 0; padding: 0; overflow: visible; }
  .dd-home-chip {
    flex-direction: column; justify-content: center; gap: 6px; height: auto; min-height: 66px; min-width: 0; padding: 10px 6px;
    border-radius: var(--dd-radius-md); white-space: normal; text-align: center; font-size: .8125rem; line-height: 1.2;
  }
  .dd-home-chip .dd-ico { width: 18px; height: 18px; }

  /* --- «Статблоки»: the list across the screen, the buttons under it; the «Создать статблок» button under the field --- */
  #dd-statblock-view .dd-sb-head { flex-wrap: wrap; gap: 8px; }
  #dd-statblock-view .dd-sb-head .dd-select { flex: 1 1 100%; width: 100%; min-width: 0; }
  #dd-statblock-view .dd-sb-head .dd-btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
  #dd-statblock-view .dd-sb-forge .dd-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  #dd-statblock-view .dd-sb-forge .dd-row > textarea { flex: 0 0 auto; width: 100%; }
  #dd-statblock-view .dd-sb-forge .dd-row > .dd-btn { width: 100%; min-height: 48px; }
  #dd-statblock-view .dd-sb-forge { padding: 12px; }

  /* --- chat: the dice in one row without the caption; whatever does not fit scrolls, a soft edge shows there is more --- */
  #dd-chat-composer .dd-quick { overscroll-behavior: auto; gap: 6px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  #dd-chat-composer .dd-quick .dd-note { display: none; }
  #dd-chat-composer .dd-quick .dd-chip { flex: 1 0 auto; justify-content: center; min-height: 36px; padding: 0 10px; }

  /* --- music player: name and download / the bar to move through the track / buttons and volume --- */
  .dd-deck {
    height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title dl" "seek seek" "ctrl vol";
    align-items: center; gap: 2px 10px; padding: 10px 14px calc(8px + env(safe-area-inset-bottom));
  }
  .dd-deck__info,
  .dd-deck__right { display: contents; }
  .dd-deck__title-row { grid-area: title; min-width: 0; }
  .dd-deck__title { min-width: 0; }
  .dd-deck__title-row .dd-deck__sub { display: none; }          /* the mood is on the track's card; the name gets the room */
  .dd-deck__right > .dd-btn { grid-area: dl; width: 40px; height: 40px; padding: 0; justify-content: center; }
  .dd-deck__seek { display: flex; grid-area: seek; gap: 8px; }
  .dd-deck .dd-deck__seek input.dd-deck__progress { height: 32px; margin: 0; }
  .dd-deck__controls { grid-area: ctrl; gap: 2px; }
  .dd-deck__btn { width: 40px; height: 40px; }
  .dd-play { width: 46px; height: 46px; margin: 0 4px; }
  .dd-deck__volume { grid-area: vol; display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 0; }
  .dd-deck .dd-deck__volume input.dd-deck__vol { width: clamp(56px, 24vw, 120px); min-width: 0; height: 32px; }
  /* the last track ends above the player (the box of the list has a fixed height, so a spacer at its end, not padding) */
  .dd-workspace--music .dd-workspace__main::after { content: ''; flex: none; height: calc(140px + env(safe-area-inset-bottom)); }
}

/* «Прикрепить изображения» in the parchment panel: the narrow-screen rule of master-tools.css (640 px) made it a 44 px
   square with the words spilling out; it is a full-width button again */
@media (max-width: 640px) {
  .dd-attach.dd-attach--wide { width: 100%; height: 44px; padding: 0 14px; }
}

/* the volume of the player: a «sound off» button next to the slider (all widths) */
.dd-deck__volume { display: flex; align-items: center; gap: 4px; }

/* ---------- 1.22.0: «Лист персонажа» and «Генератор карт» for a guest — what it is and one way in (all widths) ---------- */
.dd-members-only { max-width: 560px; }
.dd-members-only p { margin: 0; color: var(--dd-ink-muted); line-height: 1.6; text-wrap: pretty; }
.dd-members-only .dd-members-only__why { color: var(--dd-ink-primary); }
.dd-members-only__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.dd-members-only__actions .dd-btn { min-height: 46px; padding: 0 22px; justify-content: center; }
@media (max-width: 600px) {
  .dd-members-only { padding: 32px 20px; }
  .dd-members-only__actions .dd-btn { flex: 1 1 100%; }
}

/* ---------- 1.23.0: the same phone rules for the copy of a card on the search pages of the reference (/content/…). The
   copy was taken from the site frame with its wide frames (#dd-landing is a container named «landing»); without these
   the title jumped 28 px when the live card took its place on the first touch. ---------- */
@container landing (max-width: 640px) {
  #dd-landing#dd-landing .stage22-viewport-portal [role="dialog"],
  #dd-landing#dd-landing div[data-character-sheet-root="true"] [role="dialog"].fixed {
    padding: 6px 8px 80px !important;
  }
  #dd-landing#dd-landing .stage22-viewport-portal [role="dialog"] > div,
  #dd-landing#dd-landing div[data-character-sheet-root="true"] [role="dialog"] > div,
  #dd-landing#dd-landing .character-detail-panel {
    padding: 14px 12px !important;
    border-radius: 12px !important;
  }
  #dd-landing#dd-landing .character-detail-panel > section,
  #dd-landing#dd-landing .character-detail-panel > div,
  #dd-landing#dd-landing .max-w-4xl,
  #dd-landing#dd-landing .max-w-5xl,
  #dd-landing#dd-landing .max-w-6xl,
  #dd-landing#dd-landing .max-w-7xl,
  #dd-landing#dd-landing article.max-w-5xl {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  #dd-landing#dd-landing .rounded-3xl.bg-\[\#140A21\],
  #dd-landing#dd-landing .w-full.max-w-5xl > .rounded-xl.bg-\[\#130A20\] {
    padding: 14px 12px !important;
    border-radius: 12px !important;
  }
}
