:root {
    --bg: #fff7fb;
    --bg-soft: #fff0f6;
    --card: #ffffff;
    --card-2: #fff9fc;
    --text: #5a4150;
    --text-soft: #8d6a7b;
    --primary: #f59fbe;
    --primary-strong: #ec6f9c;
    --primary-dark: #d85a87;
    --line: #f3d7e3;
    --success: #f4c542;
    --success-deep: #d89b00;
    --shadow: 0 10px 30px rgba(236, 111, 156, 0.14);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --iphone-width: 430px;
    --danger: #f27b9a;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, #ffe8f2 0%, #fff7fb 35%, #fff7fb 100%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
        Roboto, "Noto Sans Thai", sans-serif;
    min-height: 100%;
}

body {
    display: flex;
    justify-content: center;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: 100%;
    max-width: var(--iphone-width);
    min-height: 100vh;
    padding: 18px 16px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    color: #70495b;
}

h2,
h3,
h4,
p {
    margin-top: 0;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: linear-gradient(180deg, #fffafc 0%, #ffe8f2 100%);
    border: 1px solid #ffd8e7;
    box-shadow: var(--shadow);
    display: grid;
    place-items: center;
    color: var(--primary-dark);
}

.icon-btn:active,
.soft-btn:active,
.primary-btn:active,
.ghost-btn:active,
.week-card:active,
.day-chip:active,
.task-item:active,
.calendar-day:active,
.list-card:active {
    transform: scale(0.98);
}

.icon-person {
    font-size: 22px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hero-card,
.calendar-card,
.list-card,
.modal-card,
.info-card,
.coach-side-panel,
.praise-box,
.empty-box {
    background: var(--card);
    border: 1px solid rgba(243, 215, 227, 0.9);
    box-shadow: var(--shadow);
}

.hero-card {
    border-radius: var(--radius-xl);
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 244, 249, 0.95)),
        radial-gradient(circle at top right, #ffdbe9, transparent 45%);
}

.hero-label {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-card h2 {
    margin-bottom: 8px;
    font-size: 22px;
    color: #6f4557;
}

.hero-subtext {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-soft);
}

.weeks-section,
.coach-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.section-title-row h3 {
    margin: 0;
    font-size: 18px;
    color: #71495a;
}

.progress-pill,
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff1f6;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #ffd6e4;
}

.weeks-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.week-card {
    position: relative;
    border-radius: 24px;
    padding: 14px 12px 16px;
    background: linear-gradient(180deg, #fffefe 0%, #fff5f9 100%);
    border: 1px solid #f7d7e4;
    box-shadow: var(--shadow);
    text-align: center;
    overflow: hidden;
}

.week-card.is-complete {
    background:
        linear-gradient(180deg, #fffdf8 0%, #fff6dc 100%);
    border-color: #f6dd8d;
}

.week-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.trophy-wrap {
    position: relative;
    width: 118px;
    height: 118px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
}

.progress-ring {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
}

.progress-ring circle {
    fill: transparent;
    stroke-width: 8;
    stroke-linecap: round;
}

.progress-bg {
    stroke: #f3e4eb;
}

.progress-fill {
    stroke: var(--primary-strong);
    transition: stroke-dashoffset 0.35s ease;
}

.week-card.is-complete .progress-fill {
    stroke: var(--success);
}

.trophy {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 38px;
    background: #fff;
    border: 1px solid #f5d8e6;
    box-shadow: inset 0 -8px 16px rgba(245, 159, 190, 0.08);
}

.week-card.is-complete .trophy {
    background: linear-gradient(180deg, #fff8d6 0%, #fff2b7 100%);
    border-color: #f2cf66;
}

.week-status {
    margin: 0;
    font-size: 12px;
    color: var(--text-soft);
}

.week-percent {
    margin-top: 6px;
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 15px;
}

.week-card.is-complete .week-percent {
    color: var(--success-deep);
}

.badge-complete {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    color: #8b6400;
    background: #fff4b8;
    border: 1px solid #f0d36b;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(93, 58, 74, 0.28);
    backdrop-filter: blur(4px);
}

.modal-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border-radius: 28px;
    padding: 22px 18px 18px;
    max-height: 85vh;
    overflow-y: auto;
    background: #fffdfd;
}

.modal-large {
    max-height: 88vh;
    aspect-ratio: 4 / 3;
}

.bottom-sheet {
    animation: slideUp 0.25s ease;
}

.modal-card.modal-large.bottom-sheet {
    inset: 0;
    margin: auto;
    width: calc(100% - 24px);
    height: 70vh;
    max-height: 70vh;
    aspect-ratio: auto;
    animation-name: fadeModal;
}

@keyframes fadeModal {
    from {
        opacity: 0.4;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0.4;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: sticky;
    top: 0;
    margin-left: auto;
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #fff0f6;
    color: var(--primary-dark);
    font-size: 24px;
    line-height: 1;
    z-index: 1;
}

.modal-head {
    margin-bottom: 16px;
}

.modal-head h2 {
    margin-bottom: 6px;
    font-size: 22px;
    color: #6d4557;
}

.modal-subtext {
    margin: 0;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.5;
}

.praise-box {
    border-radius: 22px;
    padding: 16px;
    background:
        linear-gradient(180deg, #fffaf2 0%, #fff5d9 100%);
    border-color: #f4dfa3;
}

.praise-emoji {
    font-size: 28px;
    margin-bottom: 8px;
}

.praise-title {
    margin-bottom: 6px;
    color: #845b00;
}

.praise-message {
    margin: 0;
    color: #7a6340;
    line-height: 1.6;
    white-space: pre-wrap;
}

.day-list,
.task-list,
.week-summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-chip,
.task-item,
.info-card,
.station-card,
.calendar-day,
.training-item,
.soft-btn,
.primary-btn,
.ghost-btn,
.list-card {
    border-radius: 18px;
}

.day-chip,
.task-item,
.training-item,
.list-card {
    width: 100%;
    text-align: left;
    padding: 14px 15px;
    background: var(--card-2);
    border: 1px solid #f5d9e4;
}

.day-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.day-chip-title {
    font-weight: 700;
    color: #6d4959;
}

.day-chip-meta,
.task-meta {
    font-size: 12px;
    color: var(--text-soft);
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.task-bullet {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #ffe9f2;
    color: var(--primary-dark);
    font-size: 14px;
    flex-shrink: 0;
}

.task-main {
    flex: 1;
}

.task-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: #6a4655;
}

.task-desc {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.45;
}

.empty-box {
    border-radius: 22px;
    padding: 18px;
    text-align: center;
    background: linear-gradient(180deg, #fffdfd 0%, #fff5f9 100%);
}

.empty-box h4 {
    margin-bottom: 6px;
    color: #6e4959;
}

.empty-box p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.5;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #fff1f6 0%, #ffe1ed 100%);
    border: 1px solid #f7d3e1;
    font-size: 30px;
}

.info-card-list,
.stations-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-card {
    padding: 14px 15px;
    background: linear-gradient(180deg, #ffffff 0%, #fff8fb 100%);
}

.info-label {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.profile-stations-head {
    margin-top: 4px;
}

.station-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: #fffafc;
    border: 1px solid #f5d8e4;
}

.station-card h4 {
    margin-bottom: 4px;
    font-size: 15px;
    color: #6b4555;
}

.station-card p {
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--primary-dark);
}

.station-card small {
    color: var(--text-soft);
    line-height: 1.5;
}

.station-no {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #ffe7f1;
    color: var(--primary-dark);
    font-weight: 800;
}

.soft-btn,
.primary-btn,
.ghost-btn {
    min-height: 44px;
    padding: 0 16px;
    font-weight: 700;
}

.soft-btn {
    background: #fff0f6;
    color: var(--primary-dark);
    border: 1px solid #ffd4e3;
}

.primary-btn {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: white;
    box-shadow: 0 10px 22px rgba(236, 111, 156, 0.24);
}

.ghost-btn {
    background: #fff;
    color: var(--text-soft);
    border: 1px solid #efd6e1;
}

.popup-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #6c4757;
}

.text-input,
.text-area {
    width: 100%;
    border-radius: 16px;
    border: 1px solid #f2d5e0;
    background: #fffafe;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}

.text-input:focus,
.text-area:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 159, 190, 0.16);
}

.text-area {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.calendar-card {
    border-radius: 24px;
    padding: 16px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff0f6;
    color: var(--primary-dark);
    border: 1px solid #ffd4e3;
}

.calendar-title {
    font-size: 18px;
    font-weight: 800;
    color: #6f4859;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-weekdays {
    margin-bottom: 10px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 700;
}

.calendar-day {
    min-height: 52px;
    padding: 6px 4px;
    background: #fff8fb;
    border: 1px solid #f4dce6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #755061;
    position: relative;
}

.calendar-day.is-outside {
    opacity: 0.3;
}

.calendar-day.is-today {
    border-color: var(--primary-strong);
    box-shadow: 0 0 0 3px rgba(245, 159, 190, 0.16);
}

.calendar-day.is-selected {
    background: linear-gradient(180deg, #ffe8f2 0%, #ffdbe9 100%);
    color: var(--primary-dark);
    border-color: #f6b7cf;
}

.calendar-day.has-training::after {
    content: "";
    position: absolute;
    bottom: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-strong);
}

.calendar-day.is-complete-day::before {
    content: "✓";
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 11px;
    color: #938200;
}

.coach-content {
    gap: 18px;
}

.coach-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.coach-side-panel {
    border-radius: 24px;
    padding: 16px;
}

.training-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.training-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: linear-gradient(180deg, #fffefe 0%, #fff6fa 100%);
}

.check-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    flex-shrink: 0;
}

.check-wrap input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.fake-check {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid #e9bfd0;
    background: white;
    display: grid;
    place-items: center;
}

.check-wrap input:checked+.fake-check {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
    border-color: var(--primary-strong);
}

.check-wrap input:checked+.fake-check::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: 900;
}

.training-item.completed {
    opacity: 0.72;
}

.training-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: #694656;
}

.training-desc,
.panel-subtext {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.panel-title {
    margin-bottom: 8px;
    color: #70495a;
}

.note-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: 16px;
    background: #fff6db;
    border: 1px solid #f3df98;
    color: #805e00;
    font-size: 13px;
    line-height: 1.5;
}

.footer-space {
    height: 10px;
}

.loading-box {
    padding: 18px;
    text-align: center;
    color: var(--text-soft);
}

@media (max-width: 380px) {
    .weeks-grid {
        grid-template-columns: 1fr;
    }

    .trophy-wrap {
        width: 106px;
        height: 106px;
    }
}