@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800;900&display=swap');

:root{
  --bg: #F4F4F4;
  --card: rgba(255,255,255,.92);
  --text: #000;

  --mint: #59C89A;
  --lav: #C6A9E8;

  --line: rgba(0,0,0,.12);
  --line2: rgba(0,0,0,.22);

  --r-xl: 32px;
  --r-lg: 28px;
  --r-md: 18px;

  --maxw: 440px;

  --ease: cubic-bezier(.2,.8,.2,1);
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body{ height: 100%; }

body{
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(89,200,154,.35), transparent 55%),
    radial-gradient(900px 650px at 115% 10%, rgba(198,169,232,.35), transparent 55%),
    radial-gradient(900px 650px at 50% 120%, rgba(89,200,154,.18), transparent 55%),
    linear-gradient(180deg, #FFFFFF 0%, #F4F4F4 55%, #FFFFFF 100%);

  overflow: hidden;
}

.hidden{ display:none !important; }

/* App + screens */
.app{
  height: 100%;
  display: flex;
  justify-content: center;
}

.screen{
  width: 100%;
  max-width: var(--maxw);
  height: 100%;
  padding: 34px 18px 26px;
  overflow-y: auto;
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin: 10px 0 18px;
}

.title{
  margin:0;
  font-family: "Bebas Neue", Inter, sans-serif;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.6px;
  text-transform: uppercase;
  border-left: 5px solid var(--text);
  padding-left: 12px;

  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chip buttons */
.chip{
  border-radius: 999px;
  border: 2px solid var(--text);
  background: rgba(255,255,255,.9);
  padding: 10px 14px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s var(--ease), opacity .2s var(--ease);
}
.chip:active{ transform: scale(.98); opacity: .85; }

/* Stat */
.stat{
  border-radius: var(--r-lg);
  border: 2px solid var(--text);
  background: rgba(255,255,255,.92);
  padding: 14px 16px;
  font-size: 12px;
  letter-spacing: .6px;
  text-align: center;
}

/* Card */
.card{
  border-radius: var(--r-lg);
  border: 2px solid var(--text);
  background: var(--card);
}

/* Hero */
.hero{
  position: relative;
  overflow: hidden;
  padding: 26px 18px;
  margin: 16px 0 16px;
  text-align: center;
}

.hero::before{
  content:"";
  position:absolute;
  inset:-60px -60px auto -60px;
  height: 180px;
  background:
    radial-gradient(160px 110px at 20% 60%, rgba(89,200,154,.55), transparent 72%),
    radial-gradient(170px 120px at 78% 40%, rgba(198,169,232,.55), transparent 74%);
  filter: blur(2px);
  opacity: .95;
}

.hero > *{ position: relative; z-index: 1; }

.hero__icon{
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.08));
}

.hero__title{
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .9px;
  font-size: 13px;
}

.hero__subtitle{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(0,0,0,.62);
}

/* Stack */
.stack{ display:flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* Buttons */
.btn{
  width: 100%;
  border: 2px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  padding: 16px 18px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s var(--ease), opacity .2s var(--ease);
}
.btn:hover{ opacity: .96; }
.btn:active{ transform: scale(.99); opacity: .9; }

.btn--secondary{ background: #1A1A1A; }

.btn--small{
  width: auto;
  padding: 10px 12px;
  font-size: 12px;
  letter-spacing: .8px;
}

/* Footer */
.footer{
  margin-top: 20px;
  padding: 18px 0 6px;
  border-top: 1px solid var(--line);
  text-align:center;
}

.footer__text{
  font-size: 11px;
  color: rgba(0,0,0,.58);
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto 10px;
}

/* важно: ссылки не должны выпирать */
.footer__links{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
}

.footer__links a{
  display:inline-flex;
  max-width: 100%;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 2px solid var(--text);
  padding-bottom: 2px;
  opacity: .85;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.footer__links a:active{ opacity: .65; }

/* History */
.history{ margin-top: 6px; display:flex; flex-direction: column; gap: 10px; }

.history-item{
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.history-item__left{
  min-width: 0;
  display:flex;
  flex-direction: column;
  gap: 4px;
}

.history-item__title{
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.history-item__meta{
  font-size: 11px;
  color: rgba(0,0,0,.6);
}

.badge-expired{
  font-size: 11px;
  color: rgba(0,0,0,.5);
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 99999;
  backdrop-filter: blur(8px);
  padding: 18px;
}

.modal__content{
  width: min(92vw, 380px);
  border-radius: var(--r-xl);
  border: 2px solid var(--text);
  background: rgba(255,255,255,.96);
  padding: 18px 18px 18px;
}

/* ✅ новая шапка: заголовок всегда по центру */
.modal__header{
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.modal__spacer{
  width: 40px;
  height: 40px;
}

.modal__close{
  border: 2px solid var(--text);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.9);
  font-size: 22px;
  cursor: pointer;
  transition: transform .15s var(--ease), opacity .2s var(--ease);

  float: none;         /* важно: убираем float */
  justify-self: end;
}
.modal__close:active{ transform: scale(.98); opacity: .85; }

.modal__title{
  margin: 0;
  text-align:center;
  font-family: "Bebas Neue", Inter, sans-serif;
  font-size: 20px;     /* чуть меньше */
  letter-spacing: .6px;
  text-transform: uppercase;
  justify-self: center;
}

.modal__icon{
  text-align:center;
  font-size: 62px;
  margin: 10px 0 6px;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.08));
}

.modal__body{ text-align:center; }

.modal__name{
  font-size: 14px;
  font-weight: 900;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal__validity{
  margin-top: 6px;
  margin-bottom: 14px;
  font-size: 12px;
  color: rgba(0,0,0,.62);
  overflow-wrap: anywhere;
}

/* Code box */
.codebox{
  border-radius: 22px;
  border: 2px dashed var(--line2);
  background:
    radial-gradient(240px 120px at 15% 30%, rgba(89,200,154,.12), transparent 70%),
    radial-gradient(240px 120px at 85% 70%, rgba(198,169,232,.12), transparent 70%),
    #F7F7F7;
  padding: 14px 12px;
  margin-bottom: 16px;
}

.codebox__code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  overflow-wrap: anywhere;
}

/* Doc pages */
.doc{
  height: 100%;
  overflow: auto;
}

.doc__wrap{
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 18px 60px;
}

.doc__back{
  display:inline-block;
  border: 2px solid var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.9);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
}

.doc__card{
  margin-top: 16px;
  border-radius: var(--r-xl);
  border: 2px solid var(--text);
  background: rgba(255,255,255,.96);
  padding: 18px 18px;
}

/* ✅ важно: длинные заголовки не должны вылазить */
.doc h1{
  font-family: "Bebas Neue", Inter, sans-serif;
  font-size: 34px;
  letter-spacing: -.6px;
  text-transform: uppercase;
  border-left: 5px solid var(--text);
  padding-left: 12px;
  margin: 6px 0 16px;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc h2{
  margin: 18px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .6px;
  overflow-wrap: anywhere;
}

.doc p, .doc li{
  font-size: 14px;
  line-height: 1.65;
  color: rgba(0,0,0,.82);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc ul{ padding-left: 18px; }

/* Мобильная подстройка — чтобы "Конфиденциальность" никогда не ломало */
@media (max-width: 360px){
  .doc h1{ font-size: 30px; }
  .title{ max-width: 220px; }
  .modal__title{ font-size: 18px; }
}
