/* =========================
   FONTS
   ========================= */
@font-face {
  font-family: "Runiga";
  src: url("Fonts/Runiga.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "BodyFont";
  src: url("Fonts/PineWords.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "BigTitle";
  src: url("Fonts/waveruder.otf") format("truetype");
  font-display: swap;
}

/* =========================
   THEME
   ========================= */
:root{
  --bg: #1b0f0f;          /* dark chocolate */
  --tile: #6e4c4d;        /* cocoa */
  --tileDark: #593e3c;    /* pressed */
  --text: #e7c1c7;        /* dusty pink */
  --textSoft: #f0d7db;    /* lighter pink */
  --border: rgba(240,215,219,0.35);
  --shadow: rgba(0,0,0,0.35);
  --accent: #e7c1c7;     /* dusty pink (same as text) */
  --accent-2: #f0d7db;   /* lighter pink */

  --radius: 18px;
  --gap: 14px;
  --pad: 18px;
}

/* =========================
   RESET / BASE
   ========================= */
*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image: url("img/bg-tile.png");
  background-repeat: repeat;
  background-size: 360px auto;   /* можно менять */
  background-position: top left;

  color: var(--text);
}

body{
  font-family: "BodyFont", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;

  /* left padding + safe areas for iPhone */
  padding:
    calc(var(--pad) + env(safe-area-inset-top))
    calc(var(--pad) + env(safe-area-inset-right))
    calc(var(--pad) + env(safe-area-inset-bottom))
    calc(var(--pad) + env(safe-area-inset-left));

  min-height: 100vh;
}

/* headings */
h1, h2, h3{
  font-family: "Runiga", serif;
  font-weight: 400;
  margin: 10px 0 12px 0;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* links */
a{
  color: var(--textSoft);
  text-decoration: none;
}
a:active{ opacity: 0.85; }

/* =========================
   HOME BUTTON ONLY
   ========================= */
.topbar{
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.home-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 56px;
  height: 44px;

  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 14px;

  color: var(--text);
  font-family: "Runiga", serif;
  font-size: 18px;

  box-shadow: 0 10px 20px var(--shadow);
  cursor: pointer;
}

.home-btn:active{
  transform: translateY(1px);
  background: var(--tileDark);
  box-shadow: 0 7px 14px var(--shadow);
}

/* =========================
   TILE GRID (mosaic buttons)
   ========================= */
.tiles{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 12px;
}

/* big square button */
.tile{
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  width: 100%;
  aspect-ratio: 1 / 1;

  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);

  color: var(--textSoft);
  box-shadow: 0 12px 22px var(--shadow);

  padding: 14px;
  cursor: pointer;
}

/* big titles on tiles */
.tile.big{
  font-family: "BigTitle", serif;
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* normal tiles (for areas / workout names) */
.tile.normal{
  font-family: "Runiga", serif;
  font-size: 20px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.tile:active{
  transform: translateY(1px);
  background: var(--tileDark);
  box-shadow: 0 8px 16px var(--shadow);
}

/* make <a class="tile ..."> behave like button */
a.tile{
  text-decoration: none;
}

/* =========================
   CARDS + LISTS (rollerskating page)
   ========================= */
.card{
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 22px var(--shadow);
  padding: 14px;
  margin: 12px 0;
}

.card h2{
  margin-top: 0;
}

.list{
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.list-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px;
  border-radius: 14px;

  background: var(--tileDark);
  border: 1px solid rgba(240,215,219,0.22);
}

.list-item a{
  color: var(--textSoft);
}

.check{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.check input{
  width: 22px;
  height: 22px;
  accent-color: #d8a2a7;
}

/* =========================
   MOBILE TUNING
   ========================= */
@media (max-width: 380px){
  body{ font-size: 16px; }
  .tile.big{ font-size: 28px; }
  .tile.normal{ font-size: 18px; }
}

/* larger screens: 3 columns */
@media (min-width: 760px){
  .tiles{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* =========================
   ROUTINE PAGE (splits.html)
   ========================= */
.routine-card {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 22px var(--shadow);
  padding: var(--pad);
  margin-top: 12px;
}

.step-name {
  font-family: "Runiga", serif;
  font-size: 28px;
  margin: 0 0 4px 0;
  color: var(--textSoft);
  text-align: center;
}

.step-meta {
  font-family: "BodyFont", sans-serif;
  font-size: 15px;
  color: var(--text);
  opacity: 0.8;
  text-align: center;
  margin-bottom: 16px;
}

.step-image-wrap {
  width: 100%;
  margin: 0 0 16px 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--tileDark);
  min-height: 120px;
}

.step-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 12px;
  background: var(--tileDark);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.time-left {
  font-family: "Runiga", serif;
  font-size: 20px;
  color: var(--textSoft);
  min-width: 50px;
  text-align: right;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.ctrl-btn {
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--tileDark);
  color: var(--textSoft);
  font-family: "BigTitle", serif;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 14px var(--shadow);
  transition: transform 0.1s, background 0.1s;
}

.ctrl-btn:active {
  transform: translateY(2px);
  background: var(--tile);
  box-shadow: 0 3px 8px var(--shadow);
}

.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sound-toggle {
  display: flex;
  justify-content: flex-end;
}

.sound-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.sound-btn:active {
  opacity: 1;
}

/* =========================
   ROUTINE PAGE - DESKTOP
   ========================= */
@media (min-width: 760px) {
  .routine-card {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 28px;
  }

  .step-name {
    font-size: 36px;
  }

  .step-meta {
    font-size: 18px;
  }

  .time-left {
    font-size: 26px;
  }

  .progress-bar {
    height: 16px;
  }

  .ctrl-btn {
    font-size: 22px;
    padding: 14px 28px;
  }
}