:root {
    --primary: #007aff;
    --primary-bg: #f2f2f7;
    --label: #6e6e73;
    --input-bg: rgba(255,255,255,0.96);
    --text: #1c1c1e;
    --shadow: 0 2px 8px 0 rgba(0,0,0,0.05);
    --field-width: 320px;
    --button-size: 2.45em;
    --input-radius: 8px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --primary-bg: #18181c;
        --label: #b0b0b5;
        --input-bg: rgba(30,30,33,0.98);
        --text: #f7f7fa;
        --shadow: 0 2px 8px 0 rgba(0,0,0,0.24);
    }
}
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--primary-bg);
    color: var(--text);
    min-height: 100vh;
    width: 100vw;
}
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}
.header {
    width: 100%;
    max-width: calc(var(--field-width) + var(--button-size) + 8px);
    box-sizing: border-box;
    padding: 2.7rem 0 1.3rem 0.5rem;
    font-size: 2.2rem;
    font-weight: 850;
    letter-spacing: -0.01em;
    text-align: left;
    color: #000;
    background: var(--primary-bg);
    user-select: none;
    transition: color 0.2s;
    padding-left: 21px;
}
@media (prefers-color-scheme: dark) {
    .header {
        color: #fff;
    }
}
.form-area {
    width: 100%;
    max-width: calc(var(--field-width) + var(--button-size) + 8px);
    box-sizing: border-box;
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.15em;
}
label {
    color: var(--label);
    font-size:0.85em;
    font-weight:400;
    letter-spacing: 0.00em;
    text-transform: uppercase;
    margin-bottom: 0.25em;
    margin-left: 25px;   /* NEU: Startet nach der Rundung! */
    display: block;
}
input[type=password], input[type=text] {
    width: var(--field-width);
    font-size: 1.13rem;
    padding: 0.5em 1em;     /* Deutlich flacher! */
    height: 2.2em;            /* Feste Höhe, an iOS angepasst */
    min-height: unset;
    border-radius: var(--input-radius);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    box-shadow: var(--shadow);
    color: var(--text);
    transition: border 0.18s;
    outline: none;
    margin-left: 0.5em;
    margin-right: 0.5em;
    box-sizing: border-box;
    font-weight:350;
}
input[type=password]:focus, input[type=text]:focus {
    border-color: var(--primary);
}
.input-row,
.output-row {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
}

.input-row input,
.output-row #passwordOutput {
    width: 100%;
    box-sizing: border-box;
    padding-right: 2.2em; /* Platz für das Icon */
}

.icon-button {
    position: absolute;
    right: 0.4em;
    top: 50%;
    transform: translateY(-50%);

    border: none;
    box-shadow: none;
    font-size: 1em;
    padding: 0;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    outline: none;
    height: 1.8em;
    width: 1.8em;
    backdrop-filter: blur(10px);
    margin-right: 0.5em;
}
.icon-button svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: #8e8e93;
    transition: stroke 0.2s;
}
.icon-button:active svg,
.icon-button:focus svg {
    stroke: #007aff; /* Auf iOS: dezent blau beim Tap */
}
.output-row {
    gap: 0;
}
#passwordOutput {
    font-size: 1.13rem;
    font-weight:350;
    background: var(--input-bg);
    border-radius: var(--input-radius);
    box-shadow: var(--shadow);
    padding: 0.5em 1em;     /* Deutlich flacher! */
    height: 2.2em;            /* Feste Höhe, an iOS angepasst */
    min-height: unset;
    box-sizing: border-box;
    width: var(--field-width);
    display: flex;
    align-items: center;
    word-break: break-all;
    white-space: pre;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 2.5em;
    vertical-align: middle;
    transition: background 0.16s, border 0.16s;
    margin-left: 0.5em;
    margin-right: 0.5em;
}
/* Hide scrollbars on iOS/Webkit, show if scrolling */
#passwordOutput::-webkit-scrollbar {
    height: 6px;
    background: transparent;
}
#passwordOutput::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
@media (max-width: 370px) {
    :root { --field-width: 96vw; }
}