:root,[data-theme="light"]  {
  --color-primary: #2459f9;
  --color-secondary: #2cc856;
  --color-background: #f7f7f7;
  --color-surface: #ffffff;
  --color-surface-transparent: #ffffffbb;  
  --color-surface-green: #caffca;
  --color-on-primary: #ffffff;
  --color-on-secondary: #ffffff;
  --color-on-surface: #444444;
  --color-on-background: #444444;
  --color-gray: #bbbbbb;
  --color-on-gray: #444444;
/*  --color-active: #00ff00;
  --color-on-active: #000000;*/
  --color-error: #ff0000;
  --color-on-error: #ffffff;
  --color-link: var(--color-primary);
  --border-radius: 6px;
  --content-width: min(700px, calc(100vw - 40px));
  --header-height: 60px;
/*  --logo: url();
  --noimage: url(/public/media/img/noimage.)*/
}

[data-theme="dark"] {
  --color-primary: #2c4db0;
  --color-link: #66a4fb;
  --color-secondary: #1f913d;
  --color-background: #272822;
  --color-surface: #353434;
  --color-surface-transparent: #353434aa;
  --color-surface-green: #225c21;
  --color-on-primary: #d5d5d5;
  --color-on-secondary: #d5d5d5;
  --color-on-surface: #d4d3d3;
  --color-on-background: #cccccc;
  --color-gray: #888888;
  --color-on-gray: #ffffff;
}

.color-primary {  background-color: var(--color-primary);  color: var(--color-on-primary);}
.color-secondary {  background-color: var(--color-secondary);  color: var(--color-on-secondary);}
.color-surface {  background-color: var(--color-surface);  color: var(--color-on-surface);}
h1,h2,h3,h4,h5,h6 {margin:1rem 0;}
h1, .h1 {font-size: 1.5rem; font-weight:bold;}
h2, .h2 {font-size: 1.25rem; font-weight:bold;}
h3, .h3 {font-size: 1.1rem; font-weight:bold;}


body {
  transition: background 0.5s, color 0.5s;
  background-color: var(--color-background);
  color: var(--color-on-background);
  font-family: "Roboto", Helvetica;
  font-size: 16px;
  margin:0;
  padding:0;
  max-width:100%;
}
@media (max-width:500px) {
  body{font-size:14px;}
}
*:focus{outline:none}
* {box-sizing: border-box;}
input,button,textarea {font-size:inherit; color:inherit; font-family: inherit;}
img {max-width:100%;}
iframe {display:block;} /* убирает отступ снизу */

header {
  padding: 10px max(calc(50vw - 500px), 10px); background: var(--color-primary); color:var(--color-on-primary);display:flex; align-items:center; gap:1rem; position:sticky; top:0; z-index:10; height:var(--header-height);
  /*transition: top 0.3s ease;*/
}
a {color:var(--color-link); text-decoration:none;}
header a {color:inherit;}
.maincontainer {padding: 5rem calc(50vw - 500px); padding-bottom:20rem; display:flex; gap:1rem; min-height:calc(100dvh - var(--header-height)); will-change: background-position; }
footer { display:none; }
content {flex:1; max-width:min(700px,100vw); width:min(700px,100vw); margin: 0 auto; }
aside {width:calc(300px - 1rem); display:block;}
/*s-element-aside {position:sticky; top:74px;}*/
hr { margin:1rem auto; width:50%;}

.logo {font-size:1.8rem; font-weight:bold; color:inherit; text-decoration:none; flex-shrink:0;}
.logo img {height: 50px; width:150px; object-fit: contain;  transform: translateY(3px)}
@media(max-width:500px) {
  .logo img {width:120px;}
}
header .mainnav {display:block;}
header .mainnav a {display:inline-block; padding:3px 0.7rem; flex:1; }
s-user-headerwidget {
  display : flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  width: 170px;
}

s-element-mainmenu {display:none;}

@media (max-width:1000px) {
  header .mainnav {display:none;}
  s-element-mainmenu {display:block;}
  aside {display:none}
}

.paper{
  padding:1rem; 
  margin-bottom:1rem;
  display:block;
  box-shadow: 2px 2px 12px 0px #00000011 ;
  background: var(--color-surface);
  color: var(--color-on-surface);
  border-radius: var(--border-radius);
  display:flex;
  flex-direction: column;
  gap:0.5rem;
  max-width:max(100%,100vw);
  word-break: break-word;
}
.paper.transparent {  background: var(--color-surface-transparent); }
.floatlist {  display:flex;  flex-direction: column;  gap:0.5rem;}


.flowsettings {
  background:var(--color-surface); margin: 1rem -1rem -1rem -1rem; 
  border-bottom-right-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
  max-height:0;
  transition: max-height ease-in-out 0.5s;
  overflow:hidden;
}
.flowsettings.open {max-height:400px; }
.flowsettingstoggle {
  position:absolute;
  left:50%;
  bottom:-1rem;
  transform: translate(-50%,50%);
  width:150px;
  padding:0.1rem;
  text-align:center;
  background:var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--border-radius);
  font-size:0.8rem;
  cursor:pointer;
}
.flowsettingstoggle::before{content:"▼ "; font-size:0.5rem;}
.flowsettingstoggle::after{content:" ▼"; font-size:0.5rem;}
.flowsettings.open + .flowsettingstoggle::before{content:"▲ "; font-size:0.5rem;}
.flowsettings.open + .flowsettingstoggle::after{content:" ▲"; font-size:0.5rem;}



/* блоки редактируемого контента */
.spoiler{  position:relative; color: transparent;   text-shadow: 0 0 8px var(--color-on-surface);   cursor: pointer; }
.spoiler:before {  content: 'spoiler';  color:var(--color-on-surface); text-shadow: none; position: absolute;  top: 50%;  left: 50%;  transform: translate(-50%, -50%);  }
.spoiler * {color:inherit;}

blockquote {padding: 1rem; background: var(--color-surface-green); border-radius: var(--border-radius); margin:1rem 0; font-style: italic;}
code {padding:1rem; background: var(--color-background); border-radius: var(--border-radius); margin: 1rem 0;
  display: block;              /* чтобы был как блочный pre */
  white-space: pre-wrap;       /* сохраняет переносы строк и пробелы */
  font-family: monospace;      /* моноширинный шрифт */
  background-color: #f5f5f5;   /* как у pre */
  line-height: 1.3;
  font-size:0.9rem;
}