/* Host side (body.calm): quiet and professional. Thin borders, soft shadows, one accent colour for the main action.
   The loud look stays on the public pages, the phones and the big screen. */
body.calm {
  --line: #dcd8e3; --line2: #c9c4d3; --soft: #f5f4f8; --paper: #fafafc; --card: #fff; --muted: #5f5b69; --ink: #18161d;
  --sh: 0 1px 2px rgba(20,16,30,.06), 0 1px 1px rgba(20,16,30,.04); --sh2: 0 12px 32px rgba(20,16,30,.16);
  --prim: #d4196f; --prim-ink: #fff; --sel: #2f5bff; --sel-bg: #eef2ff; --live: #0f9d6b; --live-bg: #e7f7f0;
  background: var(--paper); font-size: 16px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.calm {
  --line: #34303d; --line2: #45404f; --soft: #1d1b22; --paper: #131117; --card: #1b1920; --muted: #aaa4b6; --ink: #f2f0f5;
  --sh: none; --sh2: 0 12px 32px rgba(0,0,0,.6); --prim: #ff4f9a; --prim-ink: #16080f; --sel: #8aa2ff; --sel-bg: #1f2540; --live: #3fd39b; --live-bg: #12291f; } }
:root[data-theme="dark"] body.calm {
  --line: #34303d; --line2: #45404f; --soft: #1d1b22; --paper: #131117; --card: #1b1920; --muted: #aaa4b6; --ink: #f2f0f5;
  --sh: none; --sh2: 0 12px 32px rgba(0,0,0,.6); --prim: #ff4f9a; --prim-ink: #16080f; --sel: #8aa2ff; --sel-bg: #1f2540; --live: #3fd39b; --live-bg: #12291f; }

.calm h1, .calm h2, .calm h3 { font-family: var(--body); font-weight: 800; letter-spacing: -0.015em; line-height: 1.15; }
.calm h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.calm h2 { font-size: 1.3rem; }
.calm :focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.calm .btn { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--sh); font-weight: 700; font-size: .95rem; transition: background .12s, border-color .12s; background: var(--card); color: var(--ink); }
.calm .btn:active { transform: none; box-shadow: none; background: var(--soft); }
@media (hover: hover) { .calm .btn:hover { transform: none; box-shadow: var(--sh); background: var(--soft); border-color: var(--muted); } }
.calm .btn.pink { background: var(--prim); border-color: var(--prim); color: var(--prim-ink); }
@media (hover: hover) { .calm .btn.pink:hover { background: var(--prim); filter: brightness(1.07); border-color: var(--prim); } }
.calm .btn.sm { min-height: 40px; padding: 6px 12px; font-size: .88rem; box-shadow: var(--sh); }
.calm .btn.big { min-height: 56px; font-size: 1.08rem; padding: 12px 20px; width: 100%; }
.calm .btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
@media (hover: hover) { .calm .btn.ghost:hover { background: var(--soft); border-color: transparent; } }
.calm .btn.danger { color: #c41a33; }
:root[data-theme="dark"] .calm .btn.danger { color: #ff7d8f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm .btn.danger { color: #ff7d8f; } }
.calm .btn svg { flex: none; }
.calm .iconbtn { width: 40px; height: 40px; min-height: 40px; padding: 0; }
.calm .iconbtn.ok { color: var(--live); }
.calm .card { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 16px; }
.calm .input, .calm textarea.input, .calm select.input { border: 1px solid var(--line2); border-radius: 10px; min-height: 44px; background: var(--card); }
.calm .input:focus { outline: 2px solid var(--sel); outline-offset: 0; border-color: var(--sel); }
.calm .lbl, .calm .field label { font-weight: 700; font-size: .85rem; color: var(--muted); }
.calm .pill { border: 1px solid var(--line2); }
.calm .logo .mark { border: 0; box-shadow: none; background: transparent; width: 40px; height: 40px; }
.calm .logo .mark img { width: 36px; height: 36px; }
.calm .switch input { border: 1px solid var(--line2); width: 46px; height: 28px; }
.calm .switch input::after { top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.calm .switch input:not(:checked) { background: var(--line2); }
.calm .switch input:checked { background: var(--live); border-color: var(--live); }
.calm .switch input:checked::after { transform: translateX(18px); background: #fff; }
.calm .linkb { border: 0; background: none; padding: 0; color: var(--sel); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* (i) tips */
.tipb { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; margin-left: 4px; border: 1px solid var(--line2); border-radius: 50%;
  background: var(--card); color: var(--muted); font: italic 700 .78rem/1 Georgia, serif; cursor: pointer; vertical-align: middle; flex: none; position: relative; }
.tipb::before { content: ""; position: absolute; inset: -11px; } /* 44px tap area */
@media (hover: hover) { .tipb:hover { color: var(--sel); border-color: var(--sel); } }
.tipbox { position: fixed; z-index: 90; background: #18161d; color: #f6f5f9; padding: 10px 12px; border-radius: 10px; font-size: .88rem; line-height: 1.45; box-shadow: var(--sh2); font-weight: 500; }

/* layout */
.calm .host .bar1 { gap: 10px; padding: 8px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--card); }
.calm .host .bar1 .title { font-family: var(--body); font-weight: 800; font-size: 1.08rem; }
.calm .host .bar1 .title:focus { outline: 2px solid var(--sel); background: var(--soft); }
.calm .host .joininfo { font-weight: 600; color: var(--muted); font-size: .9rem; gap: 6px; }
.calm .host .joininfo b { font-family: var(--body); font-weight: 800; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: 1rem; letter-spacing: .04em; }
.calm .host .body { grid-template-columns: 280px minmax(0, 1fr) 340px; }
.calm .host .list { border-right: 1px solid var(--line); background: var(--soft); gap: 6px; }
.calm .host .side { border-left: 1px solid var(--line); background: var(--paper); }
.calm .host .edit { padding: 22px clamp(16px, 3vw, 36px); gap: 18px; max-width: 860px; width: 100%; margin-inline: auto; }
.lhead { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; }
.calm .qitem { border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 9px 10px; gap: 10px; align-items: center; }
@media (hover: hover) { .calm .qitem:hover { background: var(--card); border-color: var(--line); } }
.calm .qitem.sel { outline: 0; background: var(--card); border-color: var(--sel); box-shadow: inset 3px 0 0 var(--sel); }
.calm .qitem.live { background: var(--card); color: var(--ink); }
.calm .qitem .grow { display: grid; }
.calm .qitem .tx { font-weight: 600; font-size: .93rem; }
.calm .qitem .ty { font-weight: 600; font-size: .78rem; }
.calm .qitem.live .ty { color: var(--muted); }
.qic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--sel-bg); color: var(--sel); }
.qic.big { width: 48px; height: 48px; border-radius: 12px; }
.qic.big svg { width: 26px; height: 26px; }
.livedot { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; color: var(--live); background: var(--live-bg); padding: 2px 8px; border-radius: 999px; }
.livedot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.calm #addQ { margin-top: 6px; justify-content: flex-start; }

/* start screen */
.start { display: grid; gap: 18px; padding-block: 2vh; }
.start > .hint { margin: -8px 0 0; font-size: 1rem; }
.starts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.startc { display: grid; gap: 6px; justify-items: start; text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; box-shadow: var(--sh); min-height: 150px; align-content: start; }
.startc b { font-size: 1.05rem; margin-top: 6px; }
@media (hover: hover) { .startc:hover { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); } }
.tpls { display: grid; gap: 8px; }
.start #pickType { justify-self: start; color: var(--sel); }

/* editor */
.ehead { display: flex; gap: 12px; align-items: flex-start; }
.ehead .qic { width: 44px; height: 44px; border-radius: 11px; }
.ehead h2 { margin-top: 2px; }
.ehead .hint { margin: 4px 0 0; }
.calm .optrow .key { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .85rem; }
.calm .optrow .chk { width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 10px; color: var(--muted); display: grid; place-items: center; }
.calm .optrow .chk.on { background: var(--live); border-color: var(--live); color: #fff; }
.tipnote { background: var(--sel-bg) !important; color: var(--ink) !important; }
.note { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff6e0; color: #5b4300; font-size: .9rem; }
:root[data-theme="dark"] .calm .note { background: #2e2512; color: #f5d98c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm .note { background: #2e2512; color: #f5d98c; } }
.qtools { gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.prevcard { display: grid; gap: 12px; background: var(--soft); box-shadow: none; }

/* preview: a phone and a big screen, drawn small */
.pv { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .pv { grid-template-columns: 1fr; } .pv-phone { max-width: 230px; } }
.pv figure { margin: 0; display: grid; gap: 6px; }
.pv figcaption { font-size: .78rem; font-weight: 700; color: var(--muted); }
.pv-scr { display: grid; gap: 8px; align-content: start; overflow: hidden; }
.pv-scr > b { font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.pv-phone .pv-scr { border: 6px solid #18161d; border-radius: 22px; background: #fff; color: #18161d; padding: 14px 10px; min-height: 230px; font-size: .78rem; }
.pv-big .pv-scr { border-radius: 10px; background: #111014; color: #fffdf6; padding: 14px 16px; aspect-ratio: 16 / 9; font-size: .8rem; }
.pv-big .pv-scr > b { font-size: 1rem; }
.pv-opts { display: grid; gap: 5px; }
.pv-opt { display: flex; align-items: center; gap: 6px; border: 1.5px solid #18161d; border-radius: 8px; padding: 5px 6px; font-weight: 700; overflow-wrap: anywhere; }
.pv-opt i { flex: none; width: 16px; height: 16px; border-radius: 4px; font-style: normal; color: #fff; font-size: .6rem; display: grid; place-items: center; }
.pv-quiz { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pv-quiz div { min-height: 46px; border-radius: 8px; color: #fff; display: grid; place-items: center; text-align: center; padding: 4px; font-weight: 700; overflow-wrap: anywhere; }
.pv-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pv-scale span { border: 1.5px solid #18161d; border-radius: 6px; text-align: center; padding: 6px 0; font-weight: 800; }
.pv-input { border: 1.5px solid #8d8899; border-radius: 8px; padding: 8px; color: #6b6676; }
.pv-input.tall { min-height: 60px; }
.pv-big .bars { gap: 4px; }
.pv-big .bar .lab { font-size: .72rem; }
.pv-big .bar .tr { height: 10px; border: 0; }
.pv-big .cloud { font-size: .55em; }
.pv-big .avg { font-size: 2.4rem; margin: 0; font-weight: 800; }
.pv-big .qa-item, .pv-big .cards .c { padding: 6px 8px; font-size: .72rem; border-width: 1px; }
.pv-big .up { min-width: 32px; min-height: 32px; border-width: 1px; }

/* run panel */
.calm .live-ctl { gap: 12px; }
.calm .live-ctl .now { margin: 0; font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.calm .live-ctl .hint { margin: 0; font-size: .85rem; }
.more summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: .9rem; min-height: 40px; display: flex; align-items: center; }
.more .mlist { display: grid; gap: 8px; padding-top: 4px; }
.mrow { display: flex; align-items: center; gap: 6px; }
.mrow .btn { flex: 1; justify-content: flex-start; }
.calm .stat div { border: 1px solid var(--line); background: var(--card); }
.calm .stat b { font-family: var(--body); font-weight: 800; }
.calm .pend .it { border: 1px solid var(--line); }
.calm .side .by a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.calm .side .by { line-height: 1.8; }

/* phone tab bar */
@media (max-width: 1000px) {
  .calm .host .body { grid-template-columns: 1fr; }
  .calm .host .list, .calm .host .side { border: 0; }
  .calm .host .bar1 .joininfo { order: 5; }
  .calm .host .bar1 .btn span { display: none; }
  .calm .host .bar1 #presentBtn span { display: inline; }
  .calm .mobtabs { border-top: 1px solid var(--line); background: var(--card); gap: 4px; padding-block: 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .calm .mobtabs button { border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: .82rem; display: grid; justify-items: center; gap: 2px; color: var(--muted); min-height: 52px; }
  .calm .mobtabs button[aria-selected="true"] { background: var(--sel-bg); color: var(--sel); }
}

/* pop-ups */
.calm-m { background: rgba(20, 16, 30, .45); }
.calm .modal .card, .calm-m .card { box-shadow: var(--sh2); border: 0; border-radius: 16px; padding: 22px; width: min(560px, 100%); }
.typelist { display: grid; gap: 8px; }
.typec { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.typec .grow { display: grid; gap: 2px; }
.typec span span { color: var(--muted); font-size: .88rem; }
.typec .good { font-size: .8rem !important; }
.typec.on { border-color: var(--sel); background: var(--sel-bg); }
@media (hover: hover) { .typec:hover { border-color: var(--sel); } }
.calm fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 12px 0 0; display: grid; gap: 4px; }
.calm legend { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 0 4px; }
.setrow { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.setrow .switch { flex: 1; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.qrbox { background: #fff; border-radius: 12px; padding: 12px; width: min(240px, 100%); justify-self: center; border: 1px solid var(--line); }
.qrbox.sm { width: 180px; margin-top: 8px; }
.qrbox svg { display: block; width: 100%; height: auto; }
.sep { border-top: 1px solid var(--line); padding-top: 12px; }

/* my polls */
.calm .mylist a.card { display: flex; }

/* grouped start screen and type list */
.sgroup { display: grid; gap: 8px; }
.calm-m .lbl { margin-top: 4px; }
.picbtn { flex: none; width: 44px; height: 44px; border: 1px dashed var(--line2); border-radius: 10px; display: grid; place-items: center; cursor: pointer; overflow: hidden; color: var(--muted); background: var(--card); }
.picbtn.has { border-style: solid; }
.picbtn img { width: 100%; height: 100%; object-fit: cover; }
.picbtn:focus-within { outline: 2px solid var(--sel); }
.pv-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pv-pics div { aspect-ratio: 1; border-radius: 8px; background: #eee; overflow: hidden; display: grid; place-items: center; position: relative; font-weight: 800; }
.pv-pics img { width: 100%; height: 100%; object-fit: cover; }
.pv-pics small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .6rem; padding: 1px 4px; }
.pv-slider { height: 6px; border-radius: 9px; background: #ddd; position: relative; }
.pv-slider i { position: absolute; left: 50%; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: #d4196f; margin-left: -8px; }
.pv-big .numres { font-size: .7rem; }
.pv-big .hist { height: 70px; }
.pv-big .nstats b { font-size: 1rem; }
.pv-big .guessbox { font-size: .7rem; }
.qtools .mrow { display: inline-flex; }
.tiecard { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff6e0; }
:root[data-theme="dark"] .calm .tiecard { background: #2e2512; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm .tiecard { background: #2e2512; } }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.segb { border: 0; background: transparent; border-radius: 9px; padding: 8px 12px; min-height: 40px; font-weight: 700; cursor: pointer; color: var(--muted); }
.segb.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
.pv-big.light .pv-scr { background: #fffdf6; color: #111014; border: 1px solid var(--line); }
.pv-big.light .bar .tr { background: #f3efe3; }
.pv-big:not(.light) .bar .tr { background: #2a2632; }

/* My polls: rows with a small menu (Hide / Delete), and a folded "Hidden polls" list */
body.calm .plist { display: grid; gap: 10px; }
body.calm .prow { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; position: relative; }
body.calm .pmain { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; text-decoration: none; color: inherit; }
body.calm .pmain b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.calm .iconbtn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; }
@media (hover: hover) { body.calm .iconbtn:hover { background: var(--soft); color: var(--ink); } }
body.calm .iconbtn[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
body.calm .btn.ghost { background: transparent; border-color: transparent; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
body.calm .pmenu { position: absolute; right: 8px; top: calc(100% - 6px); z-index: 30; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(20, 16, 30, .16); padding: 6px; display: grid; animation: pm .14s ease-out; }
@keyframes pm { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { body.calm .pmenu { animation: none; } }
body.calm .pmenu button { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; text-align: left; border-radius: 10px; cursor: pointer; }
@media (hover: hover) { body.calm .pmenu button:hover { background: var(--soft); } }
body.calm .pmenu button:focus-visible { background: var(--soft); outline: 2px solid var(--accent, #d4196f); outline-offset: -2px; }
body.calm .pmenu .danger { color: #c4162a; }
body.calm .hidlist { margin-top: 8px; }
body.calm .hidlist > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 10px 2px; list-style: none; display: flex; align-items: center; gap: 8px; }
body.calm .hidlist > summary::-webkit-details-marker { display: none; }
body.calm .hidlist > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
body.calm .hidlist[open] > summary::before { transform: rotate(45deg); }
body.calm .hidlist .prow { opacity: .78; }
body.calm .hidlist .pill { font-size: .8rem; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
body.calm .delbox { max-width: 440px; display: grid; gap: 10px; justify-items: start; }
body.calm .delbox h2 { font-size: 1.3rem; margin: 0; overflow-wrap: anywhere; }
body.calm .delbox p { margin: 0; }
body.calm .delicon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #fde8eb; color: #c4162a; }
body.calm .btn.danger { background: #c4162a; border-color: #c4162a; color: #fff; }
@media (hover: hover) { body.calm .btn.danger:hover { background: #a51022; } }
@media (prefers-color-scheme: dark) { body.calm .delicon { background: #3a1820; color: #ff8a98; } body.calm .pmenu .danger { color: #ff8a98; } }
