/* Albert Stein · UX-Schicht 2026 — identische Farbwelt, bessere Bedienung */
:root { color-scheme: light; }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .42; cursor: not-allowed; }
input, textarea, select { max-width: 100%; }
button, a { touch-action: manipulation; }
body { overflow-wrap: anywhere; }
body.rule-mode .rule-content-area { overflow-wrap: anywhere; }
body.rule-mode .rule-header { overflow-wrap: anywhere; }

/* Lange Regeln werden nie mehr unten abgeschnitten. */
@media (min-width: 961px) {
  body.rule-mode .page-shell > .rule-unified .rule-header { overflow: auto; scrollbar-width: thin; }
  body.rule-mode .page-shell > .rule-unified .rule-content-area {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    overscroll-behavior: contain;
    padding-right: .6rem;
  }
}
.world-search-bar input { min-height: 44px; }
.world-result { min-height: 55px; }
.world-result:focus-visible, .world-teaser:focus-visible { outline-offset: -4px; }
.rule-share-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .7rem 1rem;
  width: 100%;
}
.rule-share-tools .eyebrow { margin: 0; }
.rule-share-tools .share-description { font-size: .82rem; line-height: 1.5; color: var(--muted); margin: .3rem 0 0; }
.rule-share-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-left: auto; }
.rule-share-actions button { min-height: 42px; }
.stein-share-launch {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  padding: .75rem 1.1rem;
  font-weight: 550;
  letter-spacing: .015em;
}
.stein-share-launch:hover { background: #343330; }
.rule-unified .history-block { gap: .7rem; }
.rule-unified .history-block > form { display: inline-flex; }
.rule-unified .history-block .text-link { display: inline-flex; align-items: center; min-height: 40px; }

/* Freigabe-Studio: wie eine hochwertige Editorial-Werkzeugpalette */
.stein-share-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1080px, calc(100vw - 2rem));
  max-width: 1080px;
  max-height: min(94dvh, 1000px);
  padding: 0;
  border: 1px solid rgba(20,20,20,.18);
  border-radius: 15px;
  background: #e5dfd5;
  color: #141412;
  box-shadow: 0 35px 100px rgba(0,0,0,.27);
  overscroll-behavior: contain;
}
.stein-share-dialog::backdrop { background: rgba(13,13,12,.6); backdrop-filter: blur(8px); }
.stein-share-shell { padding: clamp(1rem,2.8vw,2.4rem); }
.stein-share-head { display:flex; justify-content:space-between; align-items:start; gap:1.5rem; margin-bottom:1.65rem; }
.stein-share-head .eyebrow { margin: 0 0 .65rem; }
.stein-share-head h2 { font-family: var(--font-display); font-weight:400; font-size:clamp(1.7rem,3.3vw,2.8rem); line-height:1.08; letter-spacing:-.03em; margin:0; }
.stein-share-sub { color:#5b5750; font-size:.87rem; line-height:1.45; margin:.65rem 0 0; max-width:40ch; }
.stein-share-close { width:40px; height:40px; flex: 0 0 40px; display:grid; place-items:center; padding:0; border-radius:50%; border:1px solid rgba(0,0,0,.18); background:transparent; color:inherit; cursor:pointer; }
.stein-share-close:hover { background:rgba(0,0,0,.07); }
.stein-share-grid { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(260px,1fr); gap:clamp(1rem,3vw,2.6rem); align-items:start; }
.stein-share-preview { min-width:0; }
.stein-share-stage {
  min-height:360px; max-height:min(62dvh,720px);
  display:flex; align-items:center; justify-content:center;
  padding:clamp(.75rem,2.2vw,1.5rem);
  overflow:hidden;
  border-radius:10px; background:#cec8bd;
  background-image:radial-gradient(circle at 50% 20%,rgba(255,255,255,.28),transparent 70%);
}
.stein-share-stage canvas {
  display:block; width:auto; height:auto;
  max-width:100%; max-height:min(56dvh,650px);
  box-shadow:0 12px 35px rgba(0,0,0,.16);
  background:#ddd7cd;
}
.stein-share-hint { color:#666158; font-size:.73rem; line-height:1.5; margin:.7rem 0 0; }
.stein-share-controls { min-width:0; display:grid; gap:1.2rem; }
.stein-share-controls fieldset { border:0; padding:0; margin:0; min-width:0; }
.stein-share-controls legend {
  display:block; width:100%; font-size:.68rem; font-weight:700;
  letter-spacing:.14em; text-transform:uppercase;
  margin:0 0 .7rem; color:#555047;
}
.stein-share-segments { display:flex; align-items:stretch; flex-wrap:wrap; gap:.45rem; }
.stein-share-segments button {
  flex:1 1 0; min-width:75px; min-height:45px;
  border:1px solid rgba(15,15,15,.18);
  border-radius:8px; padding:.6rem .5rem;
  background:rgba(255,255,255,.22); color:#1b1a18;
  font-size:.8rem; white-space:nowrap;
}
.stein-share-segments button small { font-size:.73rem; opacity:.7; }
.stein-share-segments button[aria-pressed="true"] { background:#1b1b19; color:#f1ece2; }
.stein-share-segments button:hover:not([aria-pressed="true"]) { background:rgba(255,255,255,.55); }
.stein-share-check { display:flex; gap:.75rem; align-items:center; font-size:.85rem; padding:.4rem 0; cursor:pointer; }
.stein-share-check input { width:17px; height:17px; accent-color:#181817; }
.stein-share-check:has(input:disabled) { opacity:.45; cursor:not-allowed; }
.stein-share-buttons { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
.stein-share-buttons button { min-width:0; min-height:45px; padding:.75rem .5rem; border-radius:8px; font-size:.82rem; text-align:center; }
.stein-share-primary { grid-column:1 / -1; background:#171715; border:1px solid #171715; color:#eeeae3; font-weight:600; }
.stein-share-primary:hover { background:#393630; }
.stein-share-secondary { border:1px solid rgba(0,0,0,.25); color:#181817; background:transparent; }
.stein-share-secondary:hover { background:rgba(255,255,255,.45); }
.stein-share-feedback { margin:0; min-height:1.3rem; font-size:.78rem; color:#454239; }
.stein-toast {
  position:fixed; bottom:max(1.2rem,env(safe-area-inset-bottom)); left:50%;
  z-index:100000; transform:translate(-50%,20px);
  border-radius:8px; padding:.85rem 1.3rem;
  background:#171715; color:#f6f0e6;
  box-shadow:0 12px 40px rgba(0,0,0,.2);
  font-size:.86rem; opacity:0; pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
}
.stein-toast.is-visible { opacity:1; transform:translate(-50%,0); }
@media (max-width: 800px) {
  .stein-share-dialog { width:calc(100vw - 1rem); max-height:96dvh; }
  .stein-share-grid { grid-template-columns:1fr; }
  .stein-share-stage { min-height:180px; max-height:35dvh; }
  .stein-share-stage canvas { max-height:32dvh; }
  .stein-share-head { margin-bottom:1rem; }
  .stein-share-controls { gap:.9rem; }
  .stein-share-shell { padding:1rem; }
  .rule-share-tools { align-items:flex-start; }
  .rule-share-actions { margin-left:0; width:100%; }
  .rule-share-actions button { flex:1; }
}
@media (max-width: 440px) {
  .stein-share-segments { gap:.3rem; }
  .stein-share-segments button { min-width:66px; font-size:.73rem; }
  .stein-share-buttons { grid-template-columns:1fr 1fr; }
  .rule-share-actions { flex-direction:column; align-items:stretch; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms!important; animation-iteration-count:1!important; scroll-behavior:auto!important; transition-duration:.01ms!important; }
}

/* Redaktion und Benutzerverwaltung */
.role-form { display:flex; align-items:center; flex-wrap:wrap; gap:.55rem; }
.role-form .role-save { min-height:37px; padding:.48rem .7rem; font-size:.78rem; }
.editor-draft-status { color:var(--muted); font-size:.8rem; margin:.15rem 0 1rem; }
.editor-restore {
  display:flex; align-items:center; gap:.65rem; flex-wrap:wrap;
  padding:1rem 1.1rem; border:1px solid var(--line);
  background:rgba(255,255,255,.23); border-radius:9px;
  margin-bottom:1rem;
}
.editor-restore p { flex:1 1 230px; font-size:.84rem; margin:0; }
.editor-restore button { min-height:39px; padding:.6rem .85rem; }
@media (max-width:640px) {
  .role-form { align-items:stretch; }
  .role-form select { width:100%; }
  .role-form .role-save { flex:1; }
}

/* Mobile brandmark: previous <=390px CSS hid *every* span including logo container. */
@media (max-width: 640px) {
  .site-header .wordmark { display:inline-flex; align-items:center; flex:0 1 auto; min-width:0; gap:.65rem; }
  .site-header .wordmark .wordmark-logo-wrap { display:inline-flex !important; flex:0 0 auto; width:52px; min-width:52px; align-items:center; justify-content:center; }
  .site-header .wordmark .wordmark-logo { display:block !important; width:52px; height:auto; max-width:none; object-fit:contain; opacity:1; }
  .site-header .wordmark .wordmark-text { display:inline !important; font-size:clamp(.75rem,2.7vw,.91rem); line-height:1.2; }
  .site-header .login-trigger { flex:0 0 auto; }
}
@media (max-width:390px) {
  .site-header .wordmark .wordmark-logo-wrap { display:inline-flex !important; }
  .site-header .wordmark .wordmark-logo { display:block !important; width:46px; }
  .site-header .wordmark .wordmark-text { display:inline !important; max-width:185px; }
  .site-header .wordmark .wordmark-stein { display:inline-block !important; }
}
/* Increased card preview space on phones; full controls remain scrollable. */
@media (max-width:800px) {
  .stein-share-dialog { overflow-y:auto; overscroll-behavior:contain; }
  .stein-share-stage { min-height:250px; max-height:54dvh; }
  .stein-share-stage canvas { max-height:49dvh; }
  .stein-share-hint { font-size:.8rem; }
}
@media (max-width:440px) {
  .stein-share-stage { min-height:280px; max-height:50dvh; }
  .stein-share-stage canvas { max-height:46dvh; }
}
