/* shared/telegram.css — layout shared by CHEATREAD/telegram + SELF-PLAY/TELEGRAM [one sim now] */

/* reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* page */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Emoji', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0e0e0e !important;
    color: #eaeaea;
}
body { display: block; }

/* app frame */
.app {
    max-width: 720px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-height: none !important;
    width: 100%;
    height: 100vh;
    padding: 0 !important;
    gap: 0 !important;
    display: flex;
    flex-direction: column;
}
.chat-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat {
    flex: 1;
    border-radius: 0 !important;
    border: none !important;
    background: #0e0e0e !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* header */
.header {
    padding: 8px 14px !important;
    background: #17212b !important;
    border-bottom: none !important;
    min-height: 52px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    background: #2b3b4a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-name-wrap { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.chat-name { font-size: 15px !important; font-weight: 600; color: #ffffff; }
.chat-status { font-size: 12px; color: #6fb4ff; margin-top: 1px; }
.chat-status.typing { color: #8b8b8b; }
.dots-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #8b8b8b;
    font-size: 22px;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 50%;
    font-family: inherit;
}
.dots-btn:hover { color: #ffffff; background: rgba(255,255,255,.06); }

/* messages */
.msgs {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 14px !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px !important;
    min-height: 0;
    background: #0e0e0e !important;
}
.msgs::-webkit-scrollbar { width: 6px; }
.msgs::-webkit-scrollbar-track { background: transparent; }
.msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }
.msgs::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.15); }

/* input */
.input-area {
    background: #17212b !important;
    border-top: none !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    align-items: center;
    display: flex;
    flex-shrink: 0;
}
.input-area textarea {
    flex: 1;
    background: #0e1621 !important;
    border-radius: 18px !important;
    padding: 10px 16px !important;
    min-height: 40px;
    max-height: 120px;
    color: #ffffff;
    font-size: 15px !important;
    line-height: 1.35;
    resize: none;
    border: 1px solid #0b0f14;
    font-family: inherit;
}
.input-area textarea::placeholder { color: #5e6f7e; }
.input-area textarea:focus { outline: none; border-color: #2f4a63; }

/* toolbar */
.toolbar { flex-direction: column; align-items: stretch; }
.toolbar .menu-section { width: 100%; border-right: none !important; }
.toolbar {
    background: #1c1c1c !important;
    border-radius: 12px !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.menu-section { display: flex; align-items: center; gap: 3px; padding: 0 4px; border-right: 1px solid #2a2a2a !important; }
.menu-section:last-child { border-right: none !important; }
.menu-label { font-size: 12px; color: #5a5a5a !important; text-transform: uppercase; letter-spacing: .5px; margin-right: 4px; font-weight: 600; }
.menu-btn { background: transparent; border: none; color: #9a9a9a !important; padding: 4px 10px; border-radius: 8px !important; cursor: pointer; font-size: 15px; }
.menu-btn:hover { color: #ffffff !important; background: #2a2a2a !important; }
.menu-label-display { font-size: 13px; color: #9a9a9a !important; min-width: 28px; text-align: center; }
.menu-input-label { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #8e8e8e; }
.menu-input-label input { width: 56px; padding: 3px 8px; background: #333; border: none; border-radius: 4px; color: #e0e0e0; font-size: 14px; text-align: center; }

/* range */
.menu-range { width: 80px; accent-color: #2b5278; background: #2a2a2a !important; height: 4px; border-radius: 2px; }
.menu-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #d0d0d0; border: none; cursor: pointer; }
.menu-range::-webkit-slider-thumb:hover { background: #ffffff; }
.menu-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #d0d0d0; border: none; cursor: pointer; }
.menu-range::-moz-range-thumb:hover { background: #ffffff; }

/* footer */
.chat-footer { padding: 4px 4px 0 !important; display: flex; justify-content: flex-end; flex-shrink: 0; }
.chat-info { color: #5a5a5a !important; font-size: 12px; cursor: default; }

/* small screens */
@media (max-width: 440px) {
    .toolbar { padding: 4px 6px; gap: 2px; }
    .menu-label { font-size: 9px; display: none; }
    .menu-btn { font-size: 12px; padding: 2px 6px; }
    .menu-range { width: 40px; }
}

/* menu-reorg: one section per row inside the settings modal */
.modal-box.settings #toolbar,
.modal-box.settings #toolbar-bottom {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
.modal-box.settings #toolbar-bottom { margin-top: 6px; }
.modal-box.settings .menu-section {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 4px 0;
    border-right: none !important;
    border-bottom: 1px solid #2a2a2a !important;
}
.modal-box.settings .menu-section:last-child {
    border-bottom: none !important;
}
.modal-box.settings .menu-label {
    min-width: 84px;
}

/* mobile-only send button — symbol only */
.send-btn {
    display: none !important;
    flex-shrink: 0;
    width: 32px;
    height: 40px;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: inherit;
    box-shadow: none !important;
}
.send-btn:hover,
.send-btn:active,
.send-btn:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
@media (hover: none) and (pointer: coarse) {
    .send-btn { display: flex !important; }
}

/* ===== merged from shared/style.css ===== */
/* shared/style.css — demo look, blue own. */
:root {
  --message-in-background-color:  #212121;
  --message-out-background-color: #2b5278;
  --primary-text-color: #ffffff;
  --bubble-border-radius-big:    8px;
  --bubble-border-radius-medium: 8px;
  --bubble-margin:               .125rem;
  --bubble-margin-big:           .375rem;
  --message-padding-horizontal:  .5rem;
  --message-padding-top:         .375rem;
  --message-padding-bottom:      .375rem;
  --messages-text-size:          16px;
  --messages-line-height:        21px;
}

.msg {
  --message-background-color: var(--other-color, var(--message-in-background-color));
  --border-start-start-radius: var(--bubble-border-radius-medium);
  --border-start-end-radius:   var(--bubble-border-radius-big);
  --border-end-end-radius:     var(--bubble-border-radius-big);
  --border-end-start-radius:   var(--bubble-border-radius-medium);

  position: relative;
  margin: 0 0 var(--bubble-margin) 0;
  user-select: none;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  max-width: 85%;
  align-self: flex-start;
}

.msg.is-in  { align-self: flex-start; }
.msg.is-out {
  align-self: flex-end;
  flex-direction: row-reverse;
  --message-background-color: var(--own-color, var(--message-out-background-color));
  --border-start-start-radius: var(--bubble-border-radius-big);
  --border-start-end-radius:   var(--bubble-border-radius-medium);
  --border-end-end-radius:     var(--bubble-border-radius-medium);
  --border-end-start-radius:   var(--bubble-border-radius-big);
}

.msg.is-group-first.is-in  { --border-start-start-radius: var(--bubble-border-radius-big); }
.msg.is-group-first.is-out { --border-start-end-radius:   var(--bubble-border-radius-big); }
.msg.is-group-last         { margin-bottom: var(--bubble-margin-big); }

.msg > .bubble-content-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.msg > .bubble-content-wrapper > .bubble-content {
  max-width: 100%;
  border-start-start-radius: var(--border-start-start-radius) !important;
  border-start-end-radius: var(--border-start-end-radius) !important;
  border-end-start-radius: var(--border-end-start-radius) !important;
  border-end-end-radius: var(--border-end-end-radius) !important;
  box-shadow: 0 1px 2px 0 rgba(16, 35, 47, .15);
  position: relative;
  background-color: var(--message-background-color);
}

.msg .message {
  font-size: var(--messages-text-size);
  margin: 0.375em 0.5em 0.375em;
  max-width: 100%;
  color: var(--primary-text-color);
  line-height: var(--messages-line-height);
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg a { color: #cfe3ff; text-decoration: none; }
.msg a:hover { text-decoration: underline; }
.msg.is-in a { color: #8ab4f8; }
.msg .message p { margin: 0; display: inline; }

.msg.reacted::after {
  content: "\2764\FE0F";
  position: absolute;
  bottom: -8px;
  right: 4px;
  font-size: 11px;
  line-height: 1;
  background: var(--react-color, #8ab4f8);
  border-radius: 10px;
  padding: 2px 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  pointer-events: none;
  z-index: 3;

}
.msg.is-in.reacted::after { right: auto; left: 4px; }


/* cut corner on every bubble */
.msg.is-in  { --border-end-start-radius: 0 !important; }
.msg.is-out { --border-end-end-radius:   0 !important; }

/* fenced code blocks must not push the bubble wider than its max-width.
   <pre> defaults to white-space: pre and no wrapping; give it horizontal
   scroll inside the bubble instead of overflowing the bubble. */
.msg .message pre,
.post .post-body pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  margin: 0.4em 0;
  padding: 0.4em 0.6em;
  background: rgba(0,0,0,.25);
  border-radius: 4px;
  box-sizing: border-box;
}
.msg .message pre code,
.post .post-body pre code {
  white-space: inherit;
  word-break: inherit;
  overflow-wrap: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
/* inline code should wrap inside the bubble */
.msg .message code,
.post .post-body code {
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* the content wrapper must allow children to shrink, otherwise max-width
   on pre is ignored and the bubble grows. */
.msg > .bubble-content-wrapper,
.msg > .bubble-content-wrapper > .bubble-content {
  min-width: 0;
}
.post,
.post > .post-body {
  min-width: 0;
}
.msg blockquote {
    border-left: 3px solid var(--bq-color, #4a5a6a);
    background: color-mix(in srgb, var(--bq-color, #4a5a6a) 20%, transparent);
    margin: 4px 0;
    padding: 2px 10px;
    opacity: 1;
}
