* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #fff7e6;
    color: #2b2118;
}

.container {
    width: min(920px, 92%);
    margin: 0 auto;
    padding: 28px 0 60px;
}

h1 {
    font-size: 44px;
    margin-bottom: 4px;
}

h2 {
    margin-top: 0;
}

.tagline {
    font-size: 22px;
    font-weight: 700;
    color: #5f3512;
    margin-top: 8px;
    margin-bottom: 0;
}

.card {
    background: #ffffff;
    border: 2px solid #f2d199;
    border-radius: 22px;
    padding: 22px;
    margin: 18px 0;
    box-shadow: 0 8px 0 #f2d199;
}

.hero-card {
    background: #fff0c2;
}

input,
select {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 2px solid #e2bd7c;
    font-size: 16px;
    margin: 8px 0 18px;
}

label {
    display: block;
    font-weight: bold;
    margin-top: 14px;
}

button,
.btn {
    display: inline-block;
    border: none;
    background: #8b4a18;
    color: white;
    padding: 14px 18px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    margin-top: 8px;
}

button:hover,
.btn:hover {
    opacity: 0.9;
}

.secondary {
    background: #555;
}

.danger {
    background: #b83232;
}

.small {
    padding: 8px 12px;
    font-size: 14px;
}

.join-code {
    display: inline-block;
    font-size: 34px;
    font-weight: bold;
    letter-spacing: 2px;
    background: #2b2118;
    color: #fff7e6;
    padding: 12px 18px;
    border-radius: 16px;
    margin: 8px 0 14px;
}

.tile-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 18px;
}

.tile {
    background: #fff7e6;
    color: #2b2118;
    border: 2px solid #d49b4b;
    border-radius: 18px;
    padding: 16px 20px;
    min-width: 110px;
    box-shadow: 0 5px 0 #d49b4b;
}

.tile.active {
    background: #8b4a18;
    color: white;
    border-color: #8b4a18;
    box-shadow: 0 5px 0 #4d2a0e;
}

.preview {
    background: #fdf0d0;
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
}

.order-line {
    font-size: 24px;
    padding: 18px;
    background: #fff7e6;
    border-radius: 18px;
    margin: 12px 0;
    border: 2px dashed #d49b4b;
}

.my-order {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f2d199;
}

.my-order form {
    margin: 0;
}

@media (max-width: 600px) {
    
.brand-title {
    font-size: 64px;
}

h1 {
        font-size: 36px;
    }

    .tile {
        width: 100%;
    }

    .order-line {
        font-size: 20px;
    }

}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 40px;
}

.hero-text {
    flex: 1;
}

.hero-image {
    flex: 0 0 320px;
    text-align: center;
}

.hero-image img {
    height: 320px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.speech-bubble {
    display: inline-block;
    margin-top: 16px;
    padding: 16px 20px;
    background: white;
    border: 3px solid #8b4a18;
    border-radius: 20px;
    font-weight: bold;
    font-size: 18px;
    position: relative;
}

.speech-bubble:after {
    content: '';
    position: absolute;
    left: 30px;
    bottom: -15px;
    width: 20px;
    height: 20px;
    background: white;
    border-right: 3px solid #8b4a18;
    border-bottom: 3px solid #8b4a18;
    transform: rotate(45deg);
}

@media (max-width: 768px) {

    .hero {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .hero-image {
        flex: unset;
        width: auto;
    }

    .hero-image img {
        height: 240px;
        width: auto;
        max-width: 100%;
        object-fit: contain;
        margin: 0 auto;
    }

    .speech-bubble:after {
        left: 50%;
        margin-left: -10px;
    }
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px 20px;
    color: #7a4b1f;
    font-size: 14px;
}

.footer p {
    margin: 6px 0;
}

.brand-title {
    font-family: 'Baloo 2', cursive;
    font-size: 92px;
    line-height: 0.9;
    margin-bottom: 10px;
    color: #8b4a18;
    text-shadow: 4px 4px 0 #f2d199;
}

.copy-icon-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 48px;
    text-align: center;
}

.qr-box {
    margin: 18px 0;
    text-align: center;
}

.qr-box p {
    margin-bottom: 10px;
    font-weight: bold;
    color: #7a4b1f;
}

.qr-box img {
    width: 180px;
    max-width: 100%;
    background: white;
    padding: 12px;
    border-radius: 18px;
    border: 2px solid #f2d199;
}

/* Runner view layout fix */
.runner-card {
    display: grid !important;
    grid-template-columns: 1fr 260px !important;
    align-items: center !important;
    gap: 32px !important;
}

.runner-info {
    width: 100% !important;
}

.runner-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 18px !important;
    flex-wrap: wrap !important;
}

.runner-actions form {
    margin: 0 !important;
}

.runner-card .qr-box {
    margin: 0 !important;
    text-align: center !important;
    width: 100% !important;
}

.runner-card .qr-box img {
    width: 180px !important;
    max-width: 100% !important;
    display: block !important;
    margin: 0 auto !important;
}

@media (max-width: 700px) {
    .runner-card {
        grid-template-columns: 1fr !important;
    }

    .runner-card .qr-box {
        margin-top: 20px !important;
    }
}

.join-code-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.join-code-row .join-code {
    margin: 0;
}

.copy-icon-btn {
    margin: 0;
}

/* Global mobile optimisation */
@media (max-width: 768px) {

    body {
        font-size: 18px;
    }

    .container {
        width: 92%;
        padding: 18px 0 32px;
    }

    h1 {
        font-size: 44px;
        margin-top: 8px;
        margin-bottom: 12px;
    }

    h2 {
        font-size: 28px;
        margin-bottom: 14px;
    }

    h3 {
        font-size: 22px;
    }

    .card {
        padding: 18px;
        margin: 14px 0;
        border-radius: 18px;
        box-shadow: 0 6px 0 #f2d199;
    }

    input,
    select {
        font-size: 18px;
        padding: 16px;
        border-radius: 14px;
    }

    button,
    .btn {
        font-size: 17px;
        padding: 15px 20px;
        min-height: 48px;
    }

    .hero {
        gap: 18px;
        margin-bottom: 22px;
    }

    .tagline {
        font-size: 16px;
    }

    .speech-bubble {
        font-size: 16px;
        padding: 13px 16px;
        margin-top: 10px;
    }

    .brand-title {
        font-size: 68px;
        line-height: 0.88;
    }

    .tile-row {
        gap: 12px;
    }

    .tile {
        width: 100%;
        font-size: 18px;
        padding: 18px 20px;
        min-height: 56px;
    }

    .preview {
        font-size: 18px;
    }

    #placeOrderBtn {
        width: 100%;
        font-size: 19px;
        padding: 18px 20px;
    }

    .join-code {
        font-size: 34px;
        padding: 12px 18px;
    }

    .join-code-row {
        align-items: center;
        gap: 12px;
    }

    .copy-icon-btn {
        width: 52px;
        height: 52px;
        min-height: 52px;
        font-size: 24px;
        line-height: 52px;
    }

    .runner-card {
        display: block !important;
    }

    .runner-card .qr-box {
        margin-top: 20px !important;
        text-align: center !important;
    }

    .runner-card .qr-box img {
        width: min(300px, 88vw) !important;
    }

    .runner-actions {
        margin-top: 16px !important;
    }

    .runner-actions .danger {
        width: 100%;
        margin-top: 6px;
    }

    .order-line {
        font-size: 22px;
        padding: 16px;
    }

    .my-order {
        align-items: flex-start;
        flex-direction: column;
    }

    .my-order form,
    .my-order button {
        width: 100%;
    }

    .footer {
        margin-top: 28px;
        padding: 18px 16px 28px;
        font-size: 15px;
    }
}

@media (max-width: 420px) {

    .container {
        width: 94%;
    }

    .brand-title {
        font-size: 62px;
    }

    h1 {
        font-size: 40px;
    }

    .join-code {
        font-size: 30px;
    }

    .runner-card .qr-box img {
        width: min(290px, 90vw) !important;
    }
}

/* Tagline strengthening */
.tagline {
    font-size: 22px;
    font-weight: 700;
    color: #5f3512;
    margin-top: 8px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .tagline {
        font-size: 18px;
    }
}

.brand-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

.brand-link:hover {
    opacity: 0.9;
}

.field-error {
    background: #fff0f0;
    color: #9b1c1c;
    border: 2px solid #e2a0a0;
    border-radius: 14px;
    padding: 12px 14px;
    margin-top: -8px;
    margin-bottom: 16px;
    font-weight: 700;
}

/* Teh Tarik Foam theme */
body {
    background: #4b2e1f;
    color: #2a1810;
}

h1 {
    color: #f7e7c6;
    text-shadow: 4px 4px 0 #d4a373;
}

h2 {
    color: #f7e7c6;
}

.card,
.hero-card {
    background: #f7e7c6;
    color: #2a1810;
    border-color: #d4a373;
    box-shadow: 0 8px 0 #2a1810;
}

.card h2,
.card h3,
.card p,
.card label {
    color: #2a1810;
}

.tagline {
    color: #f7e7c6;
}

.speech-bubble {
    background: #f7e7c6;
    color: #2a1810;
    border-color: #d4a373;
}

button,
.btn {
    background: #8b4a18;
    color: #fff7e6;
}

input,
select {
    background: #fff7e6;
    color: #2a1810;
    border-color: #d4a373;
}

.tile {
    background: #fff7e6;
    color: #2a1810;
    border-color: #d4a373;
}

.tile.active {
    background: #8b4a18;
    color: #fff7e6;
    border-color: #8b4a18;
}

footer,
footer p {
    color: #f7e7c6;
}

/* Fix speech bubble tail for Teh Tarik Foam theme */
.speech-bubble:after {
    background: #f7e7c6;
    border-right-color: #d4a373;
    border-bottom-color: #d4a373;
}

/* Sweetness slider */
.slider-card {
    background: #f7e7c6;
    border: 2px solid #d4a373;
    border-radius: 22px;
    padding: 22px;
    margin: 18px 0;
    box-shadow: 0 8px 0 #2a1810;
}

.slider-label {
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    color: #2a1810;
    margin-bottom: 16px;
}

.sweetness-slider {
    width: 100%;
    accent-color: #8b4a18;
}

.slider-scale {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #2a1810;
}

.slider-scale span {
    flex: 1;
    text-align: center;
    line-height: 1.1;
}

/* Better sweetness slider UI */
.sweetness-slider {
    width: 100%;
    height: 18px;
    accent-color: #8b4a18;
    cursor: pointer;
}

.sweetness-slider::-webkit-slider-runnable-track {
    height: 12px;
    background: #d4a373;
    border-radius: 999px;
}

.sweetness-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -8px;
    background: #8b4a18;
    border: 3px solid #fff7e6;
    border-radius: 50%;
    box-shadow: 0 3px 0 #2a1810;
    cursor: pointer;
    -webkit-appearance: none;
}

.sweetness-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.sweetness-slider::-moz-range-track {
    height: 12px;
    background: #d4a373;
    border-radius: 999px;
}

.sweetness-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: #8b4a18;
    border: 3px solid #fff7e6;
    border-radius: 50%;
    box-shadow: 0 3px 0 #2a1810;
    cursor: pointer;
}

/* Force sweetness slider to use full card width */
.slider-card {
    display: block;
    width: 100%;
}

.slider-label {
    display: block;
    width: 100%;
    text-align: center;
}

.sweetness-slider {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* Sweetness Makcik Health Inspector */
.sweetness-makcik {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 18px auto 0;
}

@media (max-width: 768px) {
    .sweetness-makcik {
        width: 110px;
        height: 110px;
    }
}

/* Smaller Makcik above sweetness slider */
.sweetness-makcik {
    width: 120px !important;
    height: 120px !important;
    margin: 0 auto 12px !important;
}

@media (max-width: 768px) {
    .sweetness-makcik {
        width: 110px !important;
        height: 110px !important;
    }
}
