/* «Мой круг» в браузере — тот же тёплый тёмный стиль, что в приложении.
   Под iPhone: отступы под «чёлку» и полосу «Домой» (safe-area), поля 16px
   (Safari не увеличивает страницу при вводе), без синей подсветки тапа */
/* Шрифт заголовков — тот же Cormorant, что в приложении (свой файл: внешние
   шрифты сайт не пускает) */
@font-face { font-family: "Cormorant Garamond"; src: url("/app/fonts/cormorant-medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
:root {
  --bg: #120e0b; --card: #1d1814; --card2: #231c17; --line: #2c241d; --line2: #3a3027;
  --text: #efe6d8; --muted: #a89c8e; --gold: #e2be72; --goldt: #f1d79a; --err: #e88b7d; --ok: #9fd3a8;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text);
  background: var(--bg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
a { color: var(--gold); text-decoration: none; }
button { font: inherit; color: inherit; }
#app { max-width: 520px; margin: 0 auto; padding: calc(var(--top) + 18px) 18px calc(var(--bottom) + 96px); }
#app.bare { padding-bottom: calc(var(--bottom) + 32px); }

/* Нижние вкладки — как у приложений на iPhone, с отступом над полосой «Домой» */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 6px calc(var(--bottom) + 6px); background: rgba(23, 18, 15, .92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; }
#tabs a .ti { font-size: 21px; line-height: 1; }
#tabs a.on { color: var(--gold); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: -.2px; }
h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 23px; }
h3 { font-size: 19px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }
.gold { color: var(--gold); }
.err { color: var(--err); font-size: 13.5px; min-height: 19px; margin-top: 10px; }
.sec { font-size: 11px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin: 26px 0 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.spacer { height: 14px; }

.brand { font-family: var(--serif); letter-spacing: 5px; font-size: 13px; color: var(--text); }
.brand b { color: var(--gold); font-weight: 500; }

/* Кнопки — золотой контур, как на входе в приложении */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 26px;
  border: 1px solid var(--gold); background: rgba(233, 196, 110, .08); color: var(--goldt); font-size: 15.5px; font-weight: 500; letter-spacing: .3px; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn2 {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border-radius: 24px;
  border: 1px solid rgba(226, 190, 114, .5); background: rgba(233, 196, 110, .045); color: var(--goldt); font-size: 14.5px; font-weight: 500; letter-spacing: .2px; cursor: pointer;
}
.btn3 {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border-radius: 24px;
  border: 1px solid var(--line2); background: transparent; color: var(--text); font-size: 14.5px; cursor: pointer;
}
.btn2:disabled, .btn3:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--gold); font-size: 14px; padding: 12px 0; min-height: 44px; cursor: pointer; }
.link:disabled { color: var(--muted); cursor: default; }
.back { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 4px 0 14px; cursor: pointer; }

.card { border: 1px solid transparent; border-radius: 18px; padding: 16px; background: linear-gradient(rgba(239, 230, 216, .035), rgba(239, 230, 216, 0)) padding-box, linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(180deg, rgba(226, 190, 114, .2), rgba(239, 230, 216, .03)) border-box; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }

.field {
  display: block; width: 100%; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--line2);
  background: #0f0b09; color: var(--text); font-size: 16px; -webkit-appearance: none; appearance: none;
}
.field:focus { outline: none; border-color: var(--gold); }
textarea.field { font: inherit; font-size: 16px; line-height: 1.4; }
.phone { display: flex; align-items: center; gap: 10px; }
.phone span { font-size: 20px; }
.phone .field { font-size: 20px; letter-spacing: .5px; }
.code { font-size: 28px; letter-spacing: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 11px; align-items: flex-start; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.check input { width: 21px; height: 21px; margin: 0; flex: none; accent-color: var(--gold); }

.ava { border-radius: 50%; background: #3a2a20; border: 1px solid rgba(226, 190, 114, .45); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--gold); font-family: var(--serif); flex: none; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.avaf { position: relative; display: flex; align-items: center; justify-content: center; flex: none; }
.avaf .ava { border: none; }
.avaf svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tile .avaf, .masters .avaf, .pcard .avaf { margin-left: auto; margin-right: auto; }
.tile .avaf { margin-bottom: 10px; } .masters .avaf { margin-bottom: 6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; height: 38px; padding: 0 15px; border-radius: 19px; border: 1px solid var(--line2); background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.chip::after { content: ''; position: absolute; inset: -4px 0; }
.chip.on { border-color: rgba(226, 190, 114, .6); background: rgba(226, 190, 114, .12); color: var(--gold); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { border: 1px solid transparent; border-radius: 18px; padding: 16px 12px; text-align: center; color: var(--text); background: linear-gradient(rgba(239, 230, 216, .035), rgba(239, 230, 216, 0)) padding-box, linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(180deg, rgba(226, 190, 114, .2), rgba(239, 230, 216, .03)) border-box; }
.tile .ava { margin: 0 auto 10px; }

.masters { display: flex; gap: 14px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none; }
.masters::-webkit-scrollbar { display: none; }
.masters a { flex: none; width: 76px; text-align: center; color: var(--text); font-size: 12.5px; }
.masters .ava { margin: 0 auto 6px; }

.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { min-width: 0; height: 56px; border-radius: 16px; border: 1px solid var(--line2); background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.day small { font-size: 11px; color: var(--muted); }
.day b { font-weight: 400; font-size: 17px; }
.day.on { background: rgba(226, 190, 114, .14); border-color: var(--gold); color: var(--goldt); }
.day.on small { color: var(--gold); }
.day:disabled { opacity: .3; cursor: default; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.slot { height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: none; cursor: pointer; font-variant-numeric: tabular-nums; }
.slot.on { border-color: var(--gold); color: var(--gold); }

.works { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.works img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 14px; background: var(--card); display: block; }

.status { display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--line2); color: var(--muted); }
.status.wait { color: var(--gold); border-color: rgba(226, 190, 114, .45); }
.status.ok { color: var(--ok); border-color: rgba(159, 211, 168, .4); }

.hint { background: rgba(226, 190, 114, .08); border: 1px solid rgba(226, 190, 114, .3); border-radius: 16px; padding: 14px 16px; font-size: 13.5px; color: var(--text); }
.hint b { color: var(--gold); font-weight: 500; }
.x { float: right; width: 44px; height: 44px; margin: -12px -12px 0 4px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }

.skeleton { height: 64px; border-radius: 16px; background: linear-gradient(90deg, #1a1511, #221b16, #1a1511); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 84px); transform: translateX(-50%); background: #2a221b; border: 1px solid var(--line2); color: var(--text); padding: 11px 18px; border-radius: 22px; font-size: 14px; z-index: 30; max-width: 90vw; }

/* Чат */
#tabs a { position: relative; }
#tabs a.dot::after { content: ''; position: absolute; top: 3px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.udot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: none; }
#app.chat { padding: 0; max-width: 620px; }
.chat-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(var(--top) + 10px) 14px 10px; background: rgba(18, 14, 11, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.chat-head .back { padding: 6px 8px 6px 0; font-size: 22px; color: var(--text); }
.msgs { padding: 12px 12px calc(var(--comp-h, 64px) + var(--bottom) + 16px); display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: min(80%, 520px); align-self: flex-start; background: var(--card2); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 8px 12px 6px; font-size: 15.5px; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: rgba(226, 190, 114, .14); border-color: rgba(226, 190, 114, .3); border-radius: 18px 18px 6px 18px; }
.msg img { display: block; max-width: 100%; border-radius: 12px; margin: 2px 0 4px; }
.msg .t { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg .rd { color: var(--gold); }
.daysep { align-self: center; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(var(--bottom) + 8px); background: rgba(18, 14, 11, .96); border-top: 1px solid var(--line); max-width: 620px; margin: 0 auto; }
.composer textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line2); background: #0f0b09; color: var(--text); font: inherit; font-size: 16px; }
.composer textarea:focus { outline: none; border-color: var(--gold); }
.attach, .send { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px; }
.attach { border: 1px solid var(--line2); color: var(--gold); }
.send { border: 1px solid var(--gold); background: rgba(233, 196, 110, .12); color: var(--gold); }

/* ─── Иконки (SVG, контур — как в приложении) ─── */
.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
.i.s { width: 18px; height: 18px; }
#tabs a .i { width: 24px; height: 24px; }
#tabs a.on .i { stroke-width: 1.9; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(18, 14, 11, .6); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; }
.back .i { width: 20px; height: 20px; }

/* Появление экрана — мягко, без рывка */
.enter > * { animation: enter .22s ease-out both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .enter > * { animation: none; } }

/* ─── Главная ─── */
.hello { display: flex; align-items: center; gap: 14px; }
.hello .date { font-size: 13px; color: var(--muted); }
.hello .date::first-letter { text-transform: uppercase; }
.next { display: flex; gap: 14px; align-items: stretch; color: var(--text); padding: 14px; }
.next .when { flex: none; width: 64px; border-radius: 14px; background: rgba(226, 190, 114, .1); border: 1px solid rgba(226, 190, 114, .35); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold); }
.next .when b { font-size: 25px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.next .when small { font-size: 11.5px; margin-top: 3px; }
.next .what { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.next .what .t { font-size: 16px; }
.empty { text-align: center; padding: 22px 12px; border: 1px dashed var(--line2); border-radius: 18px; color: var(--muted); font-size: 14px; }
.empty .i { width: 30px; height: 30px; margin: 0 auto 8px; color: var(--gold); opacity: .8; }

/* ─── Профиль ─── */
.pcard { text-align: center; padding: 24px 16px 18px; }
.pcard .ava { margin: 0 auto; }
.pcard h1 { margin-top: 12px; }
.pcard .quote { font-family: var(--serif); font-size: 18px; font-style: italic; color: var(--text); opacity: .9; margin: 10px 0 0; }
.avawrap { position: relative; display: inline-block; cursor: pointer; }
.avawrap .cam { position: absolute; right: 2px; bottom: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--card2); border: 1px solid var(--gold); color: var(--gold); display: flex; align-items: center; justify-content: center; }
.avawrap .cam .i { width: 16px; height: 16px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border-top: 1px solid var(--line); }
.stats div { padding: 14px 0 2px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-size: 24px; font-weight: 300; color: var(--gold); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }
.list .item .i { color: var(--muted); }
.list .item .lead { color: var(--gold); }

/* ─── Шторка снизу (редактор профиля и т.п.) ─── */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); animation: fade .2s ease-out; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; background: var(--card); border: 1px solid var(--line2); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 10px 18px calc(var(--bottom) + 22px); animation: up .26s cubic-bezier(.2, .8, .2, 1); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 0 auto 14px; }
.sheet label.muted { display: block; margin: 14px 0 6px; }
.sheet .count { float: right; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-bg { animation: none; } }

/* ─── Страница мастера ─── */
.mhead { position: relative; text-align: center; }
.mhead .iconbtn { position: absolute; left: 0; top: 0; }
.cat { font-size: 11px; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase; padding: 14px 0 2px; }
.bookbar { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom) + 62px); z-index: 15; padding: 10px 18px; max-width: 560px; margin: 0 auto; background: linear-gradient(to top, rgba(18, 14, 11, .98) 60%, rgba(18, 14, 11, 0)); }
.bookbar .btn { background: #241c14; }
#app.withbar { padding-bottom: calc(var(--bottom) + 170px); }

/* ─── Широкий экран: складной iPhone, iPad, компьютер ─── */
@media (min-width: 720px) {
  #app { max-width: 720px; padding-left: 28px; padding-right: 28px; }
  .grid2 { grid-template-columns: repeat(3, 1fr); }
  .works { grid-template-columns: repeat(3, 1fr); }
  .masters a { width: 92px; }
  #tabs { justify-content: center; gap: 24px; }
  #tabs a { flex: none; width: 88px; }
  .bookbar, .sheet { max-width: 680px; }
  #app.chat, .composer { max-width: 760px; }
  .chips { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; }
}

/* ─── Отклик на касание (на iOS :active работает при touchstart-обработчике в app.js) ─── */
.btn, .btn2, .btn3, .chip, .tile, .slot, .day, .iconbtn, #tabs a, .list .item, a.card, .attach, .send { transition: transform .12s ease, background-color .12s ease; }
.btn2:active:not(:disabled), .btn3:active:not(:disabled), .chip:active, .tile:active, .slot:active, .day:active:not(:disabled), .iconbtn:active, .attach:active, .send:active, a.card:active { transform: scale(.97); }
.list .item:active, #tabs a:active { background-color: rgba(226, 190, 114, .06); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (hover: hover) {
  .btn:hover:not(:disabled), .btn2:hover:not(:disabled) { background-color: rgba(233, 196, 110, .12); }
  .tile:hover, a.card:hover { filter: brightness(1.08); }
}

/* Подложка под часы и батарею в режиме «на экране Домой» и мягкое свечение снизу */
body::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: var(--top); z-index: 25; background: rgba(18, 14, 11, .85); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(120% 50% at 50% 115%, #4a2a16 0%, rgba(18, 14, 11, 0) 70%); }

/* Кнопка в процессе: «Отправляем…» и золотой кружок */
.busy { position: relative; pointer-events: none; opacity: .8; }
.busy::after { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(226, 190, 114, .3); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ошибка с «Повторить» и пустые состояния — один вид везде */
.state { text-align: center; padding: 26px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.state .ring { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: rgba(226, 190, 114, .1); color: var(--gold); }
.state h3 { font-size: 20px; }
.state p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.state .btn2 { width: auto; display: inline-flex; padding: 0 20px; margin-top: 14px; }
.state.bad .ring { background: rgba(232, 139, 125, .1); color: var(--err); }

/* Шторка-вопрос (вместо системного confirm) */
.ask h2 { margin-bottom: 6px; }
.ask p { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.btn.danger { border-color: var(--err); color: var(--err); background: rgba(232, 139, 125, .08); }

/* Тост — один, с появлением */
.toast { animation: up2 .2s ease-out; }
@keyframes up2 { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (min-width: 720px) {
  #app.bare { max-width: 460px; }
  #app.bare.chat { max-width: 760px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .masters { margin: 0; padding-left: 0; padding-right: 0; }
}

.composer.kb { padding-bottom: 8px; }
.composer { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
.msg img { min-height: 120px; background: var(--card); }
