/* ===========================================================================
   Telegram design tokens + base reset.

   Replicates the look of Telegram Web K (github.com/morethanwords/tweb): the
   exact accent blue, surface/text colors, Roboto typography, radii, shadows,
   ripple timing and the day/night palette. Values mirror tweb/src/scss.

   Theme selection:
   - Inside a Telegram Mini App, app.js maps Telegram themeParams onto these
     variables live, so the survey matches the user's exact Telegram theme.
   - On the open website, the `.night` class is toggled from
     prefers-color-scheme.
   =========================================================================== */

/* ---- Fonts (self-hosted, copied from tweb) ------------------------------- */
/* Roboto 400 — cyrillic */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Roboto'), local('Roboto-Regular'),
    url('fonts/KFOmCnqEu92Fr1Mu5mxKKTU1Kvnz.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Roboto 400 — latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Roboto'), local('Roboto-Regular'),
    url('fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Roboto 400 — latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Roboto'), local('Roboto-Regular'),
    url('fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
/* Roboto 500 — cyrillic */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Roboto Medium'), local('Roboto-Medium'),
    url('fonts/KFOlCnqEu92Fr1MmEU9fABc4AMP6lbBP.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Roboto 500 — latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Roboto Medium'), local('Roboto-Medium'),
    url('fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Roboto 500 — latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Roboto Medium'), local('Roboto-Medium'),
    url('fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  /* Accent + state */
  --primary-color: #3390ec;
  --primary-color-rgb: 51, 144, 236;
  --dark-primary-color: #2b7ed4;
  --light-primary-color: #eaf3fc;
  --link-color: #3390ec;
  --green-color: #4dcd5e;
  --danger-color: #df3f40;
  --light-danger-color: #fbdbdb;

  /* Surfaces + text (DAY) */
  --surface-color: #ffffff;
  --surface-color-rgb: 255, 255, 255;
  --background-color: #f4f4f5;
  --primary-text-color: #000000;
  --secondary-text-color: #707579;
  --secondary-color: #c4c9cc;
  --border-color: #e6ecf0;
  --divider-color: rgba(0, 0, 0, 0.08);
  --input-border-color: #dfe1e5;
  --input-placeholder-color: #9ba0a5;
  --poll-circle-color: var(--border-color);
  --ripple-color: rgba(0, 0, 0, 0.08);
  --skeleton-color: rgba(0, 0, 0, 0.07);

  /* Typography */
  --font-regular: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-weight-normal: 400;
  --font-weight-bold: 500;
  --font-size: 16px;
  --line-height: 1.3125;

  /* Shape */
  --radius-medium: 16px;
  --radius-big: 22px;
  --radius-small: 10px;
  --section-radius: 16px;
  --control-height: 3rem; /* 48px touch target */

  /* Motion (Telegram's standard material easing) */
  --easing: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-in: 0.3s var(--easing);
  --transition-out: 0.25s var(--easing);
  --ripple-duration: 0.4s;

  /* Shadows */
  --section-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --float-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);

  /* Viewport (kept in sync with Telegram viewport / window.innerHeight). */
  --vh: 1vh;
  --app-height: calc(var(--vh) * 100);
  --safe-top: 0px;
  --safe-bottom: 0px;

  --disabled-opacity: 0.3;
}

/* Night palette — applied when `.night` is on <html>. Inside the Mini App these
   are overridden again by Telegram themeParams (see app.js). */
html.night {
  --surface-color: #212121;
  --surface-color-rgb: 33, 33, 33;
  --background-color: #181818;
  --primary-text-color: #ffffff;
  --secondary-text-color: #aaaaaa;
  --secondary-color: #707579;
  --border-color: #101010;
  --divider-color: rgba(255, 255, 255, 0.08);
  --input-border-color: #2f2f2f;
  --input-placeholder-color: #7d7d7d;
  --poll-circle-color: #545454;
  --ripple-color: rgba(255, 255, 255, 0.08);
  --skeleton-color: rgba(255, 255, 255, 0.07);
  --light-primary-color: rgba(51, 144, 236, 0.16);
  --section-shadow: none;
}

/* ---- Reset --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-regular);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--primary-text-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Prevent iOS text auto-zoom and tap highlight. */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

/* tgico icon font (reused from Telegram). A <span class="tgico"> whose text is
   the glyph char renders a pixel-perfect Telegram icon. */
@font-face {
  font-family: 'tgico';
  src: url('fonts/tgico.woff') format('woff'),
    url('fonts/tgico.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

.tgico {
  font-family: 'tgico' !important;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  speak: never;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
