/* Course + Profile upgrade only. Existing Reader/Music/Movie styles are intentionally untouched. */

.course-level-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  max-width:900px;
  margin:0 auto;
}
.course-level-card{
  min-height:150px;
  padding:20px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  color:var(--text);
  text-decoration:none;
  box-shadow:0 10px 28px rgba(20,30,25,.045);
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;
}
.course-level-card:hover{
  transform:translateY(-2px);
  border-color:#bdcec6;
  box-shadow:0 14px 34px rgba(20,30,25,.07);
}
.course-level-number{
  color:var(--muted);
  font-size:10px;
  font-weight:750;
  letter-spacing:.1em;
}
.course-level-icon{
  margin-top:18px;
  font-size:31px;
  line-height:1;
}
.course-level-card strong{
  margin-top:10px;
  font-size:20px;
  line-height:1.2;
  letter-spacing:-.02em;
}
.course-map-top{
  max-width:620px;
  margin:0 auto 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.course-back{
  width:44px;
  height:44px;
  border:1px solid var(--line);
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#fff;
  color:var(--text);
  text-decoration:none;
  font-size:20px;
}
.course-map-level{
  display:flex;
  align-items:center;
  gap:7px;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  font-size:13px;
}
.course-situation-map{
  position:relative;
  width:min(560px,100%);
  height:1040px;
  margin:0 auto;
}
.course-map-road{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
}
.course-map-road path{
  fill:none;
  stroke:#dfe5df;
  stroke-width:9;
  stroke-linecap:round;
}
.course-situation{
  position:absolute;
  transform:translate(-50%,-50%);
  width:140px;
  text-align:center;
}
.course-situation-button{
  width:78px;
  height:78px;
  margin:0 auto;
  border:5px solid var(--line);
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#fff;
  color:var(--text);
  text-decoration:none;
  font-size:28px;
  box-shadow:0 6px 0 #d7ddd8;
  transition:transform .12s ease,border-color .12s ease,background .12s ease;
  -webkit-tap-highlight-color:transparent;
}
.course-situation-button:hover{
  border-color:#a9c4b5;
  background:var(--accent-2);
}
.course-situation-button:active{
  transform:translateY(3px);
  box-shadow:0 3px 0 #d7ddd8;
}
.course-situation-name{
  margin-top:9px;
  font-size:13px;
  line-height:1.25;
  font-weight:700;
}
.course-modal[hidden]{display:none!important}
.course-modal{
  position:fixed;
  inset:0;
  z-index:100;
  display:grid;
  place-items:center;
  padding:20px;
}
.course-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(18,28,23,.42);
  backdrop-filter:blur(4px);
}
.course-modal-card{
  position:relative;
  z-index:1;
  width:min(390px,100%);
  padding:28px 24px 24px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  box-shadow:0 24px 70px rgba(14,25,19,.22);
  text-align:center;
}
.course-modal-close{
  position:absolute;
  right:10px;
  top:8px;
  width:36px;
  height:36px;
  border:0;
  background:transparent;
  color:var(--muted);
  font-size:26px;
  cursor:pointer;
}
.course-modal-icon{
  font-size:40px;
  line-height:1;
  margin:4px 0 15px;
}
.course-modal-card h2{
  margin:0 0 20px;
  font-size:20px;
  line-height:1.4;
}
body.course-modal-open{overflow:hidden}

.profile-card{
  display:flex;
  align-items:center;
  gap:18px;
  padding:22px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
}
.profile-avatar{
  width:70px;
  height:70px;
  flex:0 0 70px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--accent-2);
  color:var(--accent-dark);
  font-size:25px;
  font-weight:800;
}
.profile-main{min-width:0}
.profile-main h1{
  margin:5px 0 2px;
  font-size:27px;
  line-height:1.15;
  overflow-wrap:anywhere;
}
.profile-username{
  color:var(--muted);
  font-size:13px;
  overflow-wrap:anywhere;
}
.profile-link-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:16px;
}
.profile-link-card{
  position:relative;
  min-width:0;
  min-height:112px;
  padding:18px 44px 18px 18px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:var(--text);
  text-decoration:none;
  display:flex;
  align-items:center;
  gap:13px;
}
.profile-link-card:hover{background:#fbfcfa;border-color:#cfd8d2}
.profile-link-icon{
  width:44px;
  height:44px;
  flex:0 0 44px;
  border-radius:13px;
  display:grid;
  place-items:center;
  background:var(--accent-2);
  color:var(--accent);
  font-size:22px;
}
.profile-link-card strong{display:block;font-size:16px}
.profile-link-card small{display:block;margin-top:4px;color:var(--muted);font-size:11px;line-height:1.45}
.profile-link-card b{
  position:absolute;
  right:17px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
}

@media(max-width:680px){
  .course-level-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .course-level-card{
    min-height:112px;
    padding:12px;
    border-radius:14px;
    box-shadow:0 7px 20px rgba(20,30,25,.04);
  }
  .course-level-number{font-size:8px;letter-spacing:.06em}
  .course-level-icon{font-size:24px;margin-top:9px}
  .course-level-card strong{font-size:14px;margin-top:6px;line-height:1.15;overflow-wrap:anywhere}
  .course-map-top{margin-bottom:0}
  .course-situation-map{height:930px}
  .course-situation{width:112px}
  .course-situation-button{
    width:66px;
    height:66px;
    border-width:4px;
    font-size:24px;
    box-shadow:0 5px 0 #d7ddd8;
  }
  .course-situation-name{font-size:11px;margin-top:7px}
  .course-modal{padding:14px}
  .course-modal-card{padding:26px 20px 20px;border-radius:16px}
  .profile-card{padding:17px;gap:13px}
  .profile-avatar{width:58px;height:58px;flex-basis:58px;font-size:21px}
  .profile-main h1{font-size:22px}
  .profile-link-grid{grid-template-columns:1fr;gap:9px}
  .profile-link-card{min-height:86px;padding:14px 40px 14px 14px}
}

/* v1.1 — mobile Course viewport balance + Profile subpage navigation */
.course-home-shell{
  width:100%;
}
.profile-subpage-back-wrap{
  margin:0 0 16px;
}
.profile-subpage-back{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:40px;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:650;
  box-shadow:0 5px 16px rgba(20,30,25,.035);
  -webkit-tap-highlight-color:transparent;
}
.profile-subpage-back:hover{
  border-color:#bdcec6;
  background:#fbfcfa;
}
.profile-subpage-back:active{
  transform:translateY(1px);
}

@media(max-width:680px){
  .course-home-shell{
    /* Fill the usable app viewport between the header and the bottom navigation. */
    min-height:calc(100dvh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 52px);
    display:flex;
  }
  .course-level-grid{
    flex:1;
    width:100%;
    max-width:none;
    margin:0;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-rows:repeat(3,minmax(0,1fr));
    gap:10px;
  }
  .course-level-card{
    position:relative;
    min-height:0;
    height:100%;
    padding:34px 14px 14px;
    border-radius:18px;
    justify-content:center;
    box-shadow:0 8px 22px rgba(20,30,25,.045);
  }
  .course-level-number{
    position:absolute;
    top:13px;
    left:14px;
    font-size:8px;
    letter-spacing:.08em;
  }
  .course-level-icon{
    margin-top:0;
    font-size:29px;
    line-height:1;
  }
  .course-level-card strong{
    margin-top:10px;
    font-size:15px;
    line-height:1.12;
  }
  .profile-subpage-back-wrap{
    margin:0 0 14px;
  }
  .profile-subpage-back{
    min-height:38px;
    padding:7px 11px;
    font-size:12px;
  }
}

/* Extra-tight phones: keep all six levels visible without forcing page scroll. */
@media(max-width:680px) and (max-height:700px){
  .course-home-shell{
    min-height:calc(100dvh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 42px);
  }
  .course-level-grid{gap:8px}
  .course-level-card{padding:29px 12px 10px;border-radius:15px}
  .course-level-number{top:10px;left:12px}
  .course-level-icon{font-size:25px}
  .course-level-card strong{font-size:13px;margin-top:7px}
}
